import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Account;
import org.rsbot.script.methods.Bank;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.GroundItems;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.Menu;
import org.rsbot.script.methods.Mouse;
import org.rsbot.script.methods.NPCs;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Players;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.wrappers.RSGroundItem;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSModel;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;

@ScriptManifest(authors={"Conderoga"}, keywords={"Woodcutting"}, name="Conderoga's Chopper", version=1.23D, description="Chops trees and stuff.")
public class CChop extends Script
  implements PaintListener, MessageListener, MouseListener
{
  private boolean guiWait;
  private boolean guiExit;
  private String location;
  private RSTile tree1;
  private RSTile tree2;
  private RSTile tree3;
  private RSTile tree4;
  private RSTile tree5;
  private RSTile tree6;
  private RSTile tree7;
  private RSTile[] treesToBank;
  private RSTile[] bankToTrees;
  private boolean tree1Status;
  private boolean tree2Status;
  private boolean tree3Status;
  private boolean tree4Status;
  private boolean tree5Status;
  private boolean tree6Status;
  private boolean tree7Status;
  private long tree1TimeDead;
  private long tree2TimeDead;
  private long tree3TimeDead;
  private long tree4TimeDead;
  private long tree5TimeDead;
  private long tree6TimeDead;
  private long tree7TimeDead;
  private long tree1DeadTime;
  private long tree2DeadTime;
  private long tree3DeadTime;
  private long tree4DeadTime;
  private long tree5DeadTime;
  private long tree6DeadTime;
  private long tree7DeadTime;
  private long tree1TimeAlive;
  private long tree2TimeAlive;
  private long tree3TimeAlive;
  private long tree4TimeAlive;
  private long tree5TimeAlive;
  private long tree6TimeAlive;
  private long tree7TimeAlive;
  private long tree1AliveTime;
  private long tree2AliveTime;
  private long tree3AliveTime;
  private long tree4AliveTime;
  private long tree5AliveTime;
  private long tree6AliveTime;
  private long tree7AliveTime;
  private int nextTree;
  private int bankerID;
  private int yewPrice;
  private int magicPrice;
  private int willowPrice;
  private int maplePrice;
  private int oakPrice;
  public CChop.CChopGUI gui;
  private boolean nearest;
  private boolean takeBreaks;
  private boolean breakActive;
  private int breakLength;
  private long breakStart;
  private Point stump1;
  private Point stump2;
  private Point stump3;
  private Point stump4;
  private Point stump5;
  private Point stump6;
  private Point stump7;
  public int[] BNIDs;
  public int[] hatchetIDs;
  private int yewsCut;
  private int magicsCut;
  private int ivyCut;
  private int willowsCut;
  private int maplesCut;
  private int oaksCut;
  private int nests;
  private boolean full;
  private int startLevel;
  private int startExp;
  private int expGained;
  private int lvlsGained;
  private long startTime;
  private long failSafeTimer;
  private double startTimeDbl;
  private int safety;
  private String status;
  private Point p;
  private final String version = "v1.23";
  private String currentVersion;
  private String treeType;
  private int treeID;
  private final ArrayList<Integer> ivyIDs;
  private final ArrayList<Integer> stumpIDs;
  private int stumpID;
  private RSTile bankLocation;
  private String chopType;
  private String command;
  private boolean showPaint;
  private boolean fancyPaint;
  private final Image img1;
  private final Image img2;
  private final Image img4;
  private Color mouseColor;

  public CChop()
  {
    this.guiWait = true;
    this.guiExit = true;

    this.nextTree = 0;

    this.yewPrice = 0;
    this.magicPrice = 0;
    this.willowPrice = 0;
    this.maplePrice = 0;
    this.oakPrice = 0;

    this.BNIDs = new int[] { 5070, 5071, 5072, 5073, 5074, 5075, 5076, 7413, 11966 };

    this.hatchetIDs = new int[] { 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739, 13470 };

    this.yewsCut = 0;
    this.magicsCut = 0;
    this.ivyCut = 0;
    this.willowsCut = 0;
    this.maplesCut = 0;
    this.oaksCut = 0;
    this.nests = 0;
    this.full = false;

    this.safety = 0;

    this.version = "v1.23";
    this.currentVersion = "";
    this.treeType = ".";

    this.ivyIDs = new ArrayList();
    this.stumpIDs = new ArrayList();

    this.showPaint = true;
    this.fancyPaint = true;
    this.img1 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/Logo.png");
    this.img2 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/Bar.png");
    this.img4 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/EXPback-1copy.png");
    this.mouseColor = new Color(51, 153, 0, 255);
  }

  public boolean onStart()
  {
    this.startTime = System.currentTimeMillis();
    this.startTimeDbl = System.currentTimeMillis();

    int i = JOptionPane.showConfirmDialog(null, "Before using my script, would you like to thank me\nby clicking some adverts?", "Welcome", 0);

    if (i == 0)
    {
      JOptionPane.showMessageDialog(null, "<html>Thank you for your support!<br /></html>");
      openURL("http://adf.ly/317631/agsn");
    }

    if (Integer.parseInt(this.account.getPin()) != -1)
      log("Your account has a pin and may not be able to bank.");
    this.gui = new CChop.CChopGUI(this);
    this.gui.setVisible(true);
    while (this.guiWait) {
      sleep(100);
    }
    return !this.guiExit;
  }

  public void pickUpNest() {
    RSGroundItem localRSGroundItem = this.groundItems.getNearest(this.BNIDs);
    if ((localRSGroundItem != null) && (!this.inventory.isFull())) {
      this.status = "Nest!";
      sleep(random(600, 800));
      if (localRSGroundItem.doAction("Take"))
        this.nests += 1;
      sleep(random(600, 800));
    }
  }

  public boolean chopCheck() {
    if (!this.treeType.equals("ivy")) {
      if ((this.players.getMyPlayer().getAnimation() == 867) || (this.players.getMyPlayer().getAnimation() == 2846) || (this.players.getMyPlayer().getAnimation() == 10251) || (this.players.getMyPlayer().getAnimation() == 875) || (this.players.getMyPlayer().getAnimation() == 869))
      {
        this.status = "Chopping!";
        return true;
      }
      this.status = "Not chopping.";
    } else {
      for (int i = 0; i < 5; i++) {
        if ((this.players.getMyPlayer().getAnimation() == 870) || (this.players.getMyPlayer().getAnimation() == 872) || (this.players.getMyPlayer().getAnimation() == 10251))
        {
          this.status = "Chopping!";
          return true;
        }
        sleep(random(200, 300));
      }
      this.status = "Not chopping.";
    }
    return false;
  }

  public void updateStatus() {
    antiBan(random(1, 100));
    boolean bool = chopCheck();
    if ((!bool) && (!this.tree7Status) && (!this.tree6Status) && (!this.tree5Status) && (!this.tree4Status) && (!this.tree3Status) && (!this.tree2Status) && (!this.tree1Status))
    {
      this.status = "Waiting.";
    }
  }

  public void setUp() {
    this.status = "Starting up.";
    this.command = (this.location + " - " + this.chopType);
    if (this.command.equals("Draynor - Oaks")) {
      this.treeType = "oaks";
      this.treeID = 1281;
      this.stumpID = 1356;
      this.bankerID = 494;
      this.tree1 = new RSTile(3102, 3242);
      this.tree2 = new RSTile(3107, 3248);
      this.tree3 = new RSTile(0, 0);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[3];
      this.bankToTrees = new RSTile[2];

      this.treesToBank[0] = new RSTile(3107, 3250);
      this.treesToBank[1] = new RSTile(3101, 3244);
      this.treesToBank[2] = new RSTile(3092, 3244);

      this.bankToTrees[0] = new RSTile(3092, 3244);
      this.bankToTrees[1] = new RSTile(3101, 3244);
    }
    else if (this.command.equals("Grand Exchange - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 6533;
      this.tree1 = new RSTile(3205, 3504);
      this.tree2 = new RSTile(3210, 3504);
      this.tree3 = new RSTile(3222, 3503);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[6];
      this.bankToTrees = new RSTile[6];

      this.bankToTrees[0] = new RSTile(3167, 3489);
      this.bankToTrees[1] = new RSTile(3173, 3491);
      this.bankToTrees[2] = new RSTile(3183, 3490);
      this.bankToTrees[3] = new RSTile(3195, 3494);
      this.bankToTrees[4] = new RSTile(3204, 3502);
      this.bankToTrees[5] = new RSTile(3208, 3502);

      this.treesToBank[0] = new RSTile(3208, 3502);
      this.treesToBank[1] = new RSTile(3204, 3502);
      this.treesToBank[2] = new RSTile(3195, 3494);
      this.treesToBank[3] = new RSTile(3183, 3490);
      this.treesToBank[4] = new RSTile(3173, 3491);
      this.treesToBank[5] = new RSTile(3167, 3489);
    } else if (this.command.equals("Edgeville - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 5912;
      this.tree1 = new RSTile(3086, 3481);
      this.tree2 = new RSTile(3086, 3469);
      this.tree3 = new RSTile(0, 0);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[5];
      this.bankToTrees = new RSTile[5];

      this.bankToTrees[0] = new RSTile(3093, 3490);
      this.bankToTrees[1] = new RSTile(3088, 3487);
      this.bankToTrees[2] = new RSTile(3093, 3482);
      this.bankToTrees[3] = new RSTile(3094, 3476);
      this.bankToTrees[4] = new RSTile(3087, 3475);

      this.treesToBank[0] = new RSTile(3087, 3475);
      this.treesToBank[1] = new RSTile(3094, 3476);
      this.treesToBank[2] = new RSTile(3093, 3482);
      this.treesToBank[3] = new RSTile(3088, 3487);
      this.treesToBank[4] = new RSTile(3093, 3490);
    } else if (this.command.equals("Rimmington - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 6200;
      this.tree1 = new RSTile(2941, 3233);
      this.tree2 = new RSTile(2934, 3234);
      this.tree3 = new RSTile(2936, 3230);
      this.tree4 = new RSTile(2935, 3226);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[13];
      this.bankToTrees = new RSTile[13];

      this.bankToTrees[0] = new RSTile(3047, 3236);
      this.bankToTrees[1] = new RSTile(3037, 3235);
      this.bankToTrees[2] = new RSTile(3027, 3241);
      this.bankToTrees[3] = new RSTile(3016, 3242);
      this.bankToTrees[4] = new RSTile(3004, 3238);
      this.bankToTrees[5] = new RSTile(2993, 3235);
      this.bankToTrees[6] = new RSTile(2988, 3225);
      this.bankToTrees[7] = new RSTile(2979, 3223);
      this.bankToTrees[8] = new RSTile(2969, 3223);
      this.bankToTrees[9] = new RSTile(2959, 3223);
      this.bankToTrees[10] = new RSTile(2950, 3228);
      this.bankToTrees[11] = new RSTile(2942, 3230);
      this.bankToTrees[12] = new RSTile(2938, 3231);

      this.treesToBank = this.walking.reversePath(this.bankToTrees);
    }
    else if (this.command.equals("Catherby - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      if (random(1, 2) == 1)
        this.bankerID = 494;
      else {
        this.bankerID = 495;
      }
      this.tree1 = new RSTile(2766, 3428);
      this.tree2 = new RSTile(2760, 3428);
      this.tree3 = new RSTile(2761, 3432);
      this.tree4 = new RSTile(2771, 3438);
      this.tree5 = new RSTile(2756, 3431);
      this.tree6 = new RSTile(2758, 3434);
      this.tree7 = new RSTile(2755, 3434);

      this.treesToBank = new RSTile[5];
      this.bankToTrees = new RSTile[5];

      this.bankToTrees[0] = new RSTile(2809, 3440);
      this.bankToTrees[1] = new RSTile(2801, 3434);
      this.bankToTrees[2] = new RSTile(2789, 3436);
      this.bankToTrees[3] = new RSTile(2777, 3436);
      this.bankToTrees[4] = new RSTile(2767, 3431);

      this.treesToBank[0] = new RSTile(2767, 3431);
      this.treesToBank[1] = new RSTile(2777, 3436);
      this.treesToBank[2] = new RSTile(2789, 3436);
      this.treesToBank[3] = new RSTile(2801, 3434);
      this.treesToBank[4] = new RSTile(2809, 3440);
    } else if (this.command.equals("Seer's Village - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 495;
      this.tree1 = new RSTile(2715, 3460);
      this.tree2 = new RSTile(2706, 3460);
      this.tree3 = new RSTile(2706, 3465);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[4];
      this.bankToTrees = new RSTile[4];

      this.bankToTrees[0] = new RSTile(2726, 3493);
      this.bankToTrees[1] = new RSTile(2724, 3483);
      this.bankToTrees[2] = new RSTile(2723, 3474);
      this.bankToTrees[3] = new RSTile(2714, 3462);

      this.treesToBank[0] = new RSTile(2714, 3462);
      this.treesToBank[1] = new RSTile(2723, 3474);
      this.treesToBank[2] = new RSTile(2724, 3483);
      this.treesToBank[3] = new RSTile(2726, 3493);
    } else if (this.command.equals("South Falador - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 6200;
      this.tree1 = new RSTile(2997, 3312);
      this.tree2 = new RSTile(3020, 3316);
      this.tree3 = new RSTile(3042, 3320);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[9];
      this.bankToTrees = new RSTile[6];

      this.bankToTrees[0] = new RSTile(3012, 3356);
      this.bankToTrees[1] = new RSTile(3006, 3357);
      this.bankToTrees[2] = new RSTile(3006, 3346);
      this.bankToTrees[3] = new RSTile(3006, 3339);
      this.bankToTrees[4] = new RSTile(3006, 3331);
      this.bankToTrees[5] = new RSTile(3007, 3322);

      this.treesToBank[0] = new RSTile(3040, 3320);
      this.treesToBank[1] = new RSTile(3028, 3321);
      this.treesToBank[2] = new RSTile(3016, 3320);
      this.treesToBank[3] = new RSTile(3007, 3322);
      this.treesToBank[4] = new RSTile(3006, 3331);
      this.treesToBank[5] = new RSTile(3006, 3339);
      this.treesToBank[6] = new RSTile(3006, 3346);
      this.treesToBank[7] = new RSTile(3006, 3357);
      this.treesToBank[8] = new RSTile(3012, 3356);
    } else if (this.command.equals("Draynor - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 494;
      this.tree1 = new RSTile(3147, 3255);
      this.tree2 = new RSTile(3152, 3231);
      this.tree3 = new RSTile(3166, 3220);
      this.tree4 = new RSTile(3185, 3227);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[19];
      this.bankToTrees = new RSTile[7];

      this.treesToBank[0] = new RSTile(3185, 3227);
      this.treesToBank[1] = new RSTile(3177, 3226);
      this.treesToBank[2] = new RSTile(3172, 3226);
      this.treesToBank[3] = new RSTile(3166, 3222);
      this.treesToBank[4] = new RSTile(3161, 3227);
      this.treesToBank[5] = new RSTile(3158, 3232);
      this.treesToBank[6] = new RSTile(3153, 3239);
      this.treesToBank[7] = new RSTile(3152, 3245);
      this.treesToBank[8] = new RSTile(3147, 3252);
      this.treesToBank[9] = new RSTile(3146, 3244);
      this.treesToBank[10] = new RSTile(3147, 3235);
      this.treesToBank[11] = new RSTile(3145, 3230);
      this.treesToBank[12] = new RSTile(3137, 3228);
      this.treesToBank[13] = new RSTile(3126, 3226);
      this.treesToBank[14] = new RSTile(3119, 3226);
      this.treesToBank[15] = new RSTile(3110, 3229);
      this.treesToBank[16] = new RSTile(3105, 3235);
      this.treesToBank[17] = new RSTile(3101, 3242);
      this.treesToBank[18] = new RSTile(3092, 3244);

      this.bankToTrees[0] = new RSTile(3092, 3244);
      this.bankToTrees[1] = new RSTile(3104, 3238);
      this.bankToTrees[2] = new RSTile(3114, 3229);
      this.bankToTrees[3] = new RSTile(3126, 3225);
      this.bankToTrees[4] = new RSTile(3137, 3226);
      this.bankToTrees[5] = new RSTile(3144, 3229);
      this.bankToTrees[6] = new RSTile(3150, 3231);
    } else if (this.command.equals("Tree Gnome - Yews")) {
      this.treeType = "yews";
      this.treeID = 1309;
      this.stumpID = 7402;
      this.bankerID = 166;
      this.tree1 = new RSTile(2439, 3436);
      this.tree2 = new RSTile(2433, 3441);
      this.tree3 = new RSTile(2433, 3426);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[2];
      this.bankToTrees = new RSTile[2];

      this.treesToBank[0] = new RSTile(2442, 3438);
      this.treesToBank[1] = new RSTile(2445, 3427);

      this.bankToTrees[0] = new RSTile(2445, 3425);
      this.bankToTrees[1] = new RSTile(2440, 3434);
    }
    else if (this.command.equals("Seer's Village - Maples")) {
      this.treeType = "maples";
      this.treeID = 1307;
      this.stumpID = 7400;
      this.bankerID = 495;
      this.tree1 = new RSTile(2722, 3502);
      this.tree2 = new RSTile(2728, 3502);
      this.tree3 = new RSTile(2731, 3501);
      this.tree4 = new RSTile(2733, 3500);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[2];
      this.bankToTrees = new RSTile[2];

      this.bankToTrees[0] = new RSTile(2726, 3493);
      this.bankToTrees[1] = new RSTile(2729, 3501);

      this.treesToBank[0] = new RSTile(2729, 3501);
      this.treesToBank[1] = new RSTile(2726, 3493);
    }
    else if (this.command.equals("Seer's Village - Magics")) {
      this.treeType = "magics";
      this.treeID = 1306;
      this.stumpID = 7401;
      this.bankerID = 495;
      this.tree1 = new RSTile(2697, 3424);
      this.tree2 = new RSTile(2692, 3425);
      this.tree3 = new RSTile(2691, 3428);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[9];
      this.bankToTrees = new RSTile[9];

      this.bankToTrees[0] = new RSTile(2726, 3493);
      this.bankToTrees[1] = new RSTile(2725, 3487);
      this.bankToTrees[2] = new RSTile(2725, 3477);
      this.bankToTrees[3] = new RSTile(2723, 3466);
      this.bankToTrees[4] = new RSTile(2724, 3456);
      this.bankToTrees[5] = new RSTile(2713, 3449);
      this.bankToTrees[6] = new RSTile(2707, 3439);
      this.bankToTrees[7] = new RSTile(2703, 3429);
      this.bankToTrees[8] = new RSTile(2694, 3424);

      this.treesToBank[0] = new RSTile(2694, 3424);
      this.treesToBank[1] = new RSTile(2703, 3429);
      this.treesToBank[2] = new RSTile(2707, 3439);
      this.treesToBank[3] = new RSTile(2713, 3449);
      this.treesToBank[4] = new RSTile(2724, 3456);
      this.treesToBank[5] = new RSTile(2723, 3466);
      this.treesToBank[6] = new RSTile(2725, 3477);
      this.treesToBank[7] = new RSTile(2725, 3487);
      this.treesToBank[8] = new RSTile(2726, 3493);
    } else if (this.command.equals("Sorcerer's Tower - Magics")) {
      this.treeType = "magics";
      this.treeID = 1306;
      this.stumpID = 7401;
      this.bankerID = 495;
      this.tree1 = new RSTile(2705, 3397);
      this.tree2 = new RSTile(2705, 3399);
      this.tree3 = new RSTile(2699, 3399);
      this.tree4 = new RSTile(2699, 3397);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[12];
      this.bankToTrees = new RSTile[12];

      this.bankToTrees[0] = new RSTile(2726, 3493);
      this.bankToTrees[1] = new RSTile(2725, 3487);
      this.bankToTrees[2] = new RSTile(2725, 3477);
      this.bankToTrees[3] = new RSTile(2723, 3466);
      this.bankToTrees[4] = new RSTile(2724, 3456);
      this.bankToTrees[5] = new RSTile(2713, 3449);
      this.bankToTrees[6] = new RSTile(2707, 3439);
      this.bankToTrees[7] = new RSTile(2703, 3429);
      this.bankToTrees[8] = new RSTile(2709, 3418);
      this.bankToTrees[9] = new RSTile(2715, 3406);
      this.bankToTrees[10] = new RSTile(2714, 3396);
      this.bankToTrees[11] = new RSTile(2701, 3398);

      this.treesToBank[0] = new RSTile(2701, 3398);
      this.treesToBank[1] = new RSTile(2714, 3396);
      this.treesToBank[2] = new RSTile(2715, 3406);
      this.treesToBank[3] = new RSTile(2709, 3418);
      this.treesToBank[4] = new RSTile(2703, 3429);
      this.treesToBank[5] = new RSTile(2707, 3439);
      this.treesToBank[6] = new RSTile(2713, 3449);
      this.treesToBank[7] = new RSTile(2724, 3456);
      this.treesToBank[8] = new RSTile(2723, 3466);
      this.treesToBank[9] = new RSTile(2725, 3477);
      this.treesToBank[10] = new RSTile(2725, 3487);
      this.treesToBank[11] = new RSTile(2726, 3493);
    } else if (this.command.equals("Mage Training Area - Magics")) {
      this.treeType = "magics";
      this.treeID = 1306;
      this.stumpID = 7401;
      this.bankLocation = new RSTile(3381, 3269);

      this.tree1 = new RSTile(3357, 3312);
      this.tree2 = new RSTile(3369, 3312);
      this.tree3 = new RSTile(0, 0);
      this.tree4 = new RSTile(0, 0);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[7];
      this.bankToTrees = new RSTile[7];

      this.bankToTrees[0] = new RSTile(3381, 3268);
      this.bankToTrees[1] = new RSTile(3370, 3266);
      this.bankToTrees[2] = new RSTile(3358, 3265);
      this.bankToTrees[3] = new RSTile(3349, 3274);
      this.bankToTrees[4] = new RSTile(3348, 3282);
      this.bankToTrees[5] = new RSTile(3360, 3287);
      this.bankToTrees[6] = new RSTile(3363, 3298);

      this.treesToBank[0] = new RSTile(3363, 3298);
      this.treesToBank[1] = new RSTile(3360, 3287);
      this.treesToBank[2] = new RSTile(3348, 3282);
      this.treesToBank[3] = new RSTile(3349, 3274);
      this.treesToBank[4] = new RSTile(3358, 3265);
      this.treesToBank[5] = new RSTile(3370, 3266);
      this.treesToBank[6] = new RSTile(3382, 3268);
    }
    else if (this.command.equals("Castle Wars - Ivy")) {
      this.bankLocation = new RSTile(2445, 3083);
      this.treeType = "ivy";

      if (random(1, 2) == 1)
        this.camera.setAngle(random(1, 30));
      else {
        this.camera.setAngle(random(340, 359));
      }
      this.tree1 = new RSTile(2430, 3068);
      this.tree2 = new RSTile(2429, 3068);
      this.tree3 = new RSTile(2428, 3068);
      this.tree4 = new RSTile(2426, 3068);
      this.tree5 = new RSTile(2425, 3068);
      this.tree6 = new RSTile(2424, 3068);
      this.tree7 = new RSTile(2423, 3068);

      this.treesToBank = new RSTile[3];
      this.bankToTrees = new RSTile[3];

      this.bankToTrees[0] = new RSTile(2443, 3084);
      this.bankToTrees[1] = new RSTile(2444, 3073);
      this.bankToTrees[2] = new RSTile(2429, 3068);

      this.treesToBank[0] = new RSTile(2429, 3068);
      this.treesToBank[1] = new RSTile(2444, 3073);
      this.treesToBank[2] = new RSTile(2443, 3084);
    }
    else if (this.command.equals("Grand Exchange - Ivy")) {
      this.treeType = "ivy";
      this.bankerID = 6533;

      this.camera.setAngle(random(170, 190));

      this.tree1 = new RSTile(3219, 3498);
      this.tree2 = new RSTile(3218, 3498);
      this.tree3 = new RSTile(3217, 3498);
      this.tree4 = new RSTile(3216, 3498);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[6];
      this.bankToTrees = new RSTile[6];

      this.bankToTrees[0] = new RSTile(3167, 3489);
      this.bankToTrees[1] = new RSTile(3173, 3491);
      this.bankToTrees[2] = new RSTile(3183, 3490);
      this.bankToTrees[3] = new RSTile(3195, 3494);
      this.bankToTrees[4] = new RSTile(3204, 3502);
      this.bankToTrees[5] = new RSTile(3217, 3500);

      this.treesToBank[0] = new RSTile(3217, 3500);
      this.treesToBank[1] = new RSTile(3204, 3502);
      this.treesToBank[2] = new RSTile(3195, 3494);
      this.treesToBank[3] = new RSTile(3183, 3490);
      this.treesToBank[4] = new RSTile(3173, 3491);
      this.treesToBank[5] = new RSTile(3167, 3489);
    }
    else if (this.command.equals("Taverly - Ivy")) {
      this.treeType = "ivy";
      log("Nest banking is unavailable at the Taverly location.");

      this.camera.setAngle(random(260, 280));

      this.tree1 = new RSTile(2943, 3416);
      this.tree2 = new RSTile(2943, 3417);
      this.tree3 = new RSTile(2943, 3418);
      this.tree4 = new RSTile(2943, 3419);
      this.tree5 = new RSTile(2943, 3420);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);
    }
    else if (this.command.equals("Yanille - Ivy")) {
      this.bankerID = 494;
      this.treeType = "ivy";

      this.camera.setAngle(random(170, 190));

      this.tree1 = new RSTile(2597, 3111);
      this.tree2 = new RSTile(2596, 3111);
      this.tree3 = new RSTile(2595, 3111);
      this.tree4 = new RSTile(2593, 3111);
      this.tree5 = new RSTile(2592, 3111);
      this.tree6 = new RSTile(2591, 3111);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[4];
      this.bankToTrees = new RSTile[4];

      this.bankToTrees[0] = new RSTile(2613, 3094);
      this.bankToTrees[1] = new RSTile(2616, 3106);
      this.bankToTrees[2] = new RSTile(2603, 3113);
      this.bankToTrees[3] = new RSTile(2597, 3111);

      this.treesToBank[0] = new RSTile(2597, 3111);
      this.treesToBank[1] = new RSTile(2603, 3113);
      this.treesToBank[2] = new RSTile(2616, 3106);
      this.treesToBank[3] = new RSTile(2613, 3094);
    } else if (this.command.equals("Ardougne - Ivy")) {
      this.bankerID = 494;
      this.treeType = "ivy";

      this.camera.setAngle(random(80, 100));

      this.tree1 = new RSTile(2622, 3304);
      this.tree2 = new RSTile(2622, 3305);
      this.tree3 = new RSTile(2622, 3307);
      this.tree4 = new RSTile(2622, 3308);
      this.tree5 = new RSTile(2622, 3310);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[5];
      this.bankToTrees = new RSTile[5];

      this.bankToTrees[0] = new RSTile(2614, 3333);
      this.bankToTrees[1] = new RSTile(2607, 3326);
      this.bankToTrees[2] = new RSTile(2607, 3314);
      this.bankToTrees[3] = new RSTile(2614, 3312);
      this.bankToTrees[4] = new RSTile(2622, 3310);

      this.treesToBank[0] = new RSTile(2622, 3310);
      this.treesToBank[1] = new RSTile(2614, 3312);
      this.treesToBank[2] = new RSTile(2607, 3314);
      this.treesToBank[3] = new RSTile(2607, 3326);
      this.treesToBank[4] = new RSTile(2614, 3333);
    } else if (this.command.equals("Varrock Palace - Ivy")) {
      this.bankerID = 5912;
      this.treeType = "ivy";

      this.camera.setAngle(random(250, 280));

      this.tree1 = new RSTile(3233, 3456);
      this.tree2 = new RSTile(3233, 3457);
      this.tree3 = new RSTile(3233, 3459);
      this.tree4 = new RSTile(3233, 3460);
      this.tree5 = new RSTile(3233, 3461);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[5];
      this.bankToTrees = new RSTile[5];

      this.bankToTrees[0] = new RSTile(3253, 3420);
      this.bankToTrees[1] = new RSTile(3246, 3431);
      this.bankToTrees[2] = new RSTile(3245, 3441);
      this.bankToTrees[3] = new RSTile(3244, 3454);
      this.bankToTrees[4] = new RSTile(3233, 3460);

      this.treesToBank[0] = new RSTile(3233, 3460);
      this.treesToBank[1] = new RSTile(3244, 3454);
      this.treesToBank[2] = new RSTile(3245, 3441);
      this.treesToBank[3] = new RSTile(3246, 3431);
      this.treesToBank[4] = new RSTile(3253, 3420);
    } else if (this.command.equals("South Falador - Ivy")) {
      this.bankerID = 6200;
      this.treeType = "ivy";

      if (random(1, 2) == 1)
        this.camera.setAngle(random(1, 30));
      else {
        this.camera.setAngle(random(340, 359));
      }
      this.tree1 = new RSTile(3052, 3328);
      this.tree2 = new RSTile(3051, 3328);
      this.tree3 = new RSTile(3049, 3328);
      this.tree4 = new RSTile(3048, 3328);
      this.tree5 = new RSTile(3047, 3328);
      this.tree6 = new RSTile(3045, 3328);
      this.tree7 = new RSTile(3044, 3328);

      this.treesToBank = new RSTile[10];
      this.bankToTrees = new RSTile[10];

      this.bankToTrees[0] = new RSTile(3012, 3356);
      this.bankToTrees[1] = new RSTile(3006, 3357);
      this.bankToTrees[2] = new RSTile(3006, 3346);
      this.bankToTrees[3] = new RSTile(3006, 3339);
      this.bankToTrees[4] = new RSTile(3006, 3331);
      this.bankToTrees[5] = new RSTile(3007, 3322);
      this.bankToTrees[6] = new RSTile(3017, 3323);
      this.bankToTrees[7] = new RSTile(3027, 3326);
      this.bankToTrees[8] = new RSTile(3036, 3326);
      this.bankToTrees[9] = new RSTile(3044, 3327);

      this.treesToBank[0] = new RSTile(3044, 3327);
      this.treesToBank[1] = new RSTile(3036, 3326);
      this.treesToBank[2] = new RSTile(3027, 3326);
      this.treesToBank[3] = new RSTile(3017, 3323);
      this.treesToBank[4] = new RSTile(3007, 3322);
      this.treesToBank[5] = new RSTile(3006, 3331);
      this.treesToBank[6] = new RSTile(3006, 3339);
      this.treesToBank[7] = new RSTile(3006, 3346);
      this.treesToBank[8] = new RSTile(3006, 3357);
      this.treesToBank[9] = new RSTile(3012, 3356);
    } else if (this.command.equals("North Falador - Ivy")) {
      this.bankerID = 6200;
      this.treeType = "ivy";

      this.camera.setAngle(random(170, 190));

      this.tree1 = new RSTile(3018, 3392);
      this.tree2 = new RSTile(3017, 3392);
      this.tree3 = new RSTile(3016, 3392);
      this.tree4 = new RSTile(3015, 3392);
      this.tree5 = new RSTile(3014, 3392);
      this.tree6 = new RSTile(3012, 3392);
      this.tree7 = new RSTile(3011, 3392);

      this.treesToBank = new RSTile[11];
      this.bankToTrees = new RSTile[11];

      this.bankToTrees[0] = new RSTile(2946, 3368);
      this.bankToTrees[1] = new RSTile(2948, 3376);
      this.bankToTrees[2] = new RSTile(2952, 3381);
      this.bankToTrees[3] = new RSTile(2963, 3386);
      this.bankToTrees[4] = new RSTile(2968, 3397);
      this.bankToTrees[5] = new RSTile(2974, 3397);
      this.bankToTrees[6] = new RSTile(2980, 3397);
      this.bankToTrees[7] = new RSTile(2989, 3397);
      this.bankToTrees[8] = new RSTile(2994, 3396);
      this.bankToTrees[9] = new RSTile(3005, 3397);
      this.bankToTrees[10] = new RSTile(3012, 3393);

      this.treesToBank[0] = new RSTile(3012, 3393);
      this.treesToBank[1] = new RSTile(3005, 3397);
      this.treesToBank[2] = new RSTile(2994, 3396);
      this.treesToBank[3] = new RSTile(2989, 3397);
      this.treesToBank[4] = new RSTile(2980, 3397);
      this.treesToBank[5] = new RSTile(2974, 3397);
      this.treesToBank[6] = new RSTile(2968, 3397);
      this.treesToBank[7] = new RSTile(2963, 3386);
      this.treesToBank[8] = new RSTile(2952, 3381);
      this.treesToBank[9] = new RSTile(2948, 3376);
      this.treesToBank[10] = new RSTile(2946, 3368);
    } else if (this.command.equals("Draynor - Willows")) {
      this.treeType = "willows";
      this.bankerID = 494;
      this.tree1 = new RSTile(3089, 3228);
      this.tree2 = new RSTile(3088, 3232);
      this.tree3 = new RSTile(3089, 3235);
      this.tree4 = new RSTile(3086, 3236);
      this.tree5 = new RSTile(3084, 3238);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[2];
      this.bankToTrees = new RSTile[2];

      this.bankToTrees[0] = new RSTile(3092, 3245);
      this.bankToTrees[1] = new RSTile(3087, 3237);

      this.treesToBank[0] = new RSTile(3090, 3236);
      this.treesToBank[1] = new RSTile(3092, 3245);
    } else if (this.command.equals("Port Salim - Willows")) {
      this.treeType = "willows";
      this.tree1 = new RSTile(3063, 3255);
      this.tree2 = new RSTile(3063, 3253);
      this.tree3 = new RSTile(3058, 3255);
      this.tree4 = new RSTile(3058, 3252);
      this.tree5 = new RSTile(0, 0);
      this.tree6 = new RSTile(0, 0);
      this.tree7 = new RSTile(0, 0);

      this.treesToBank = new RSTile[4];

      this.treesToBank[0] = new RSTile(3059, 3252);
      this.treesToBank[1] = new RSTile(3049, 3246);
      this.treesToBank[2] = new RSTile(3042, 3240);
      this.treesToBank[3] = new RSTile(3047, 3236);

      this.bankToTrees = this.walking.reversePath(this.treesToBank);
    }
    else {
      log("Incorrect combination of chop type / location");
    }
    if (this.treeType.equals("ivy")) {
      this.ivyIDs.add(Integer.valueOf(46318));
      this.ivyIDs.add(Integer.valueOf(46320));
      this.ivyIDs.add(Integer.valueOf(46322));
      this.ivyIDs.add(Integer.valueOf(46324));
      this.stumpIDs.add(Integer.valueOf(46325));
      this.stumpIDs.add(Integer.valueOf(46323));
      this.stumpIDs.add(Integer.valueOf(46321));
      this.stumpIDs.add(Integer.valueOf(46319));
    }
    if (this.treeType.equals("willows")) {
      this.ivyIDs.add(Integer.valueOf(5553));
      this.ivyIDs.add(Integer.valueOf(5552));
      this.ivyIDs.add(Integer.valueOf(5551));
      this.stumpIDs.add(Integer.valueOf(5554));
    }
    this.status = "Finished set up.";
  }

  public int floorHeight() {
    RSNPC localRSNPC = this.npcs.getNearest(new int[] { this.bankerID });
    if (localRSNPC != null) {
      return 1;
    }
    return 0;
  }

  public void checkTrees() {
    RSObject[] arrayOfRSObject1 = this.objects.getAllAt(this.tree1);
    for (int i = 0; i < arrayOfRSObject1.length; i++) {
      if ((arrayOfRSObject1[i].getID() == this.stumpID) && (this.tree1Status)) {
        this.tree1Status = false;
        this.tree1DeadTime = System.currentTimeMillis();
        this.tree1TimeAlive = -1L;
      } else if ((arrayOfRSObject1[i].getID() == this.treeID) && (!this.tree1Status)) {
        this.tree1Status = true;
        this.tree1AliveTime = System.currentTimeMillis();
        this.tree1TimeDead = -1L;
      } else if (arrayOfRSObject1[i].getID() == this.treeID) {
        this.tree1Status = true;
        this.tree1TimeAlive = (System.currentTimeMillis() - this.tree1AliveTime);
      } else if (arrayOfRSObject1[i].getID() == this.stumpID) {
        this.tree1Status = false;
        this.tree1TimeDead = (System.currentTimeMillis() - this.tree1DeadTime);
      }
    }
    RSObject[] arrayOfRSObject2 = this.objects.getAllAt(this.tree2);
    for (int j = 0; j < arrayOfRSObject2.length; j++)
      if ((arrayOfRSObject2[j].getID() == this.stumpID) && (this.tree2Status)) {
        this.tree2Status = false;
        this.tree2DeadTime = System.currentTimeMillis();
        this.tree2TimeAlive = -1L;
      } else if ((arrayOfRSObject2[j].getID() == this.treeID) && (!this.tree2Status)) {
        this.tree2Status = true;
        this.tree2AliveTime = System.currentTimeMillis();
        this.tree2TimeDead = -1L;
      } else if (arrayOfRSObject2[j].getID() == this.treeID) {
        this.tree2Status = true;
        this.tree2TimeAlive = (System.currentTimeMillis() - this.tree2AliveTime);
      } else if (arrayOfRSObject2[j].getID() == this.stumpID) {
        this.tree2Status = false;
        this.tree2TimeDead = (System.currentTimeMillis() - this.tree2DeadTime);
      }
    RSObject[] arrayOfRSObject3;
    int k;
    if (this.tree3.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree3);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((arrayOfRSObject3[k].getID() == this.stumpID) && (this.tree3Status)) {
          this.tree3Status = false;
          this.tree3DeadTime = System.currentTimeMillis();
          this.tree3TimeAlive = -1L;
        } else if ((arrayOfRSObject3[k].getID() == this.treeID) && (!this.tree3Status)) {
          this.tree3Status = true;
          this.tree3AliveTime = System.currentTimeMillis();
          this.tree3TimeDead = -1L;
        } else if (arrayOfRSObject3[k].getID() == this.treeID) {
          this.tree3Status = true;
          this.tree3TimeAlive = (System.currentTimeMillis() - this.tree3AliveTime);
        }
        else if (arrayOfRSObject3[k].getID() == this.stumpID) {
          this.tree3Status = false;
          this.tree3TimeDead = (System.currentTimeMillis() - this.tree3DeadTime);
        }
      }
    }
    else
    {
      this.tree3Status = false;
      this.tree3TimeDead = 0L;
      this.tree3TimeAlive = 0L;
    }
    if (this.tree4.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree4);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((arrayOfRSObject3[k].getID() == this.stumpID) && (this.tree4Status)) {
          this.tree4Status = false;
          this.tree4DeadTime = System.currentTimeMillis();
          this.tree4TimeAlive = -1L;
        } else if ((arrayOfRSObject3[k].getID() == this.treeID) && (!this.tree4Status)) {
          this.tree4Status = true;
          this.tree4AliveTime = System.currentTimeMillis();
          this.tree4TimeDead = -1L;
        } else if (arrayOfRSObject3[k].getID() == this.treeID) {
          this.tree4Status = true;
          this.tree4TimeAlive = (System.currentTimeMillis() - this.tree4AliveTime);
        }
        else if (arrayOfRSObject3[k].getID() == this.stumpID) {
          this.tree4Status = false;
          this.tree4TimeDead = (System.currentTimeMillis() - this.tree4DeadTime);
        }
      }
    }
    else
    {
      this.tree4Status = false;
      this.tree4TimeDead = 0L;
      this.tree4TimeAlive = 0L;
    }
    if (this.tree5.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree5);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((arrayOfRSObject3[k].getID() == this.stumpID) && (this.tree5Status)) {
          this.tree5Status = false;
          this.tree5DeadTime = System.currentTimeMillis();
          this.tree5TimeAlive = -1L;
        } else if ((arrayOfRSObject3[k].getID() == this.treeID) && (!this.tree5Status)) {
          this.tree5Status = true;
          this.tree5AliveTime = System.currentTimeMillis();
          this.tree5TimeDead = -1L;
        } else if (arrayOfRSObject3[k].getID() == this.treeID) {
          this.tree5Status = true;
          this.tree5TimeAlive = (System.currentTimeMillis() - this.tree5AliveTime);
        }
        else if (arrayOfRSObject3[k].getID() == this.stumpID) {
          this.tree5Status = false;
          this.tree5TimeDead = (System.currentTimeMillis() - this.tree5DeadTime);
        }
      }
    }
    else
    {
      this.tree5Status = false;
      this.tree5TimeDead = 0L;
      this.tree5TimeAlive = 0L;
    }
    if (this.tree6.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree6);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((arrayOfRSObject3[k].getID() == this.stumpID) && (this.tree6Status)) {
          this.tree6Status = false;
          this.tree6DeadTime = System.currentTimeMillis();
          this.tree6TimeAlive = -1L;
        } else if ((arrayOfRSObject3[k].getID() == this.treeID) && (!this.tree6Status)) {
          this.tree6Status = true;
          this.tree6AliveTime = System.currentTimeMillis();
          this.tree6TimeDead = -1L;
        } else if (arrayOfRSObject3[k].getID() == this.treeID) {
          this.tree6Status = true;
          this.tree6TimeAlive = (System.currentTimeMillis() - this.tree6AliveTime);
        }
        else if (arrayOfRSObject3[k].getID() == this.stumpID) {
          this.tree6Status = false;
          this.tree6TimeDead = (System.currentTimeMillis() - this.tree6DeadTime);
        }
      }
    }
    else
    {
      this.tree6Status = false;
      this.tree6TimeDead = 0L;
      this.tree6TimeAlive = 0L;
    }
    if (this.tree7.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree7);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((arrayOfRSObject3[k].getID() == this.stumpID) && (this.tree7Status)) {
          this.tree7Status = false;
          this.tree7DeadTime = System.currentTimeMillis();
          this.tree7TimeAlive = -1L;
        } else if ((arrayOfRSObject3[k].getID() == this.treeID) && (!this.tree7Status)) {
          this.tree7Status = true;
          this.tree7AliveTime = System.currentTimeMillis();
          this.tree7TimeDead = -1L;
        } else if (arrayOfRSObject3[k].getID() == this.treeID) {
          this.tree7Status = true;
          this.tree7TimeAlive = (System.currentTimeMillis() - this.tree7AliveTime);
        }
        else if (arrayOfRSObject3[k].getID() == this.stumpID) {
          this.tree7Status = false;
          this.tree7TimeDead = (System.currentTimeMillis() - this.tree7DeadTime);
        }
      }
    }
    else
    {
      this.tree7Status = false;
      this.tree7TimeDead = 0L;
      this.tree7TimeAlive = 0L;
    }
  }

  public void checkIvy() {
    RSObject[] arrayOfRSObject1 = this.objects.getAllAt(this.tree1);
    for (int i = 0; i < arrayOfRSObject1.length; i++) {
      if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject1[i].getID()))) && (this.tree1Status)) {
        this.tree1Status = false;
        this.tree1DeadTime = System.currentTimeMillis();
        this.tree1TimeAlive = -1L;
      } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject1[i].getID()))) && (!this.tree1Status)) {
        this.tree1Status = true;
        this.tree1AliveTime = System.currentTimeMillis();
        this.tree1TimeDead = -1L;
      } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject1[i].getID()))) {
        this.tree1Status = true;
        this.tree1TimeAlive = (System.currentTimeMillis() - this.tree1AliveTime);
      } else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject1[i].getID()))) {
        this.tree1Status = false;
        this.tree1TimeDead = (System.currentTimeMillis() - this.tree1DeadTime);
      }
    }
    RSObject[] arrayOfRSObject2 = this.objects.getAllAt(this.tree2);
    for (int j = 0; j < arrayOfRSObject2.length; j++)
      if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject2[j].getID()))) && (this.tree2Status)) {
        this.tree2Status = false;
        this.tree2DeadTime = System.currentTimeMillis();
        this.tree2TimeAlive = -1L;
      } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject2[j].getID()))) && (!this.tree2Status)) {
        this.tree2Status = true;
        this.tree2AliveTime = System.currentTimeMillis();
        this.tree2TimeDead = -1L;
      } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject2[j].getID()))) {
        this.tree2Status = true;
        this.tree2TimeAlive = (System.currentTimeMillis() - this.tree2AliveTime);
      } else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject2[j].getID()))) {
        this.tree2Status = false;
        this.tree2TimeDead = (System.currentTimeMillis() - this.tree2DeadTime);
      }
    RSObject[] arrayOfRSObject3;
    int k;
    if (this.tree3.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree3);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (this.tree3Status)) {
          this.tree3Status = false;
          this.tree3DeadTime = System.currentTimeMillis();
          this.tree3TimeAlive = -1L;
        } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (!this.tree3Status))
        {
          this.tree3Status = true;
          this.tree3AliveTime = System.currentTimeMillis();
          this.tree3TimeDead = -1L;
        } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree3Status = true;
          this.tree3TimeAlive = (System.currentTimeMillis() - this.tree3AliveTime);
        }
        else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree3Status = false;
          this.tree3TimeDead = (System.currentTimeMillis() - this.tree3DeadTime);
        }
      }
    }
    else
    {
      this.tree3Status = false;
      this.tree3TimeDead = 0L;
      this.tree3TimeAlive = 0L;
    }
    if (this.tree4.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree4);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (this.tree4Status)) {
          this.tree4Status = false;
          this.tree4DeadTime = System.currentTimeMillis();
          this.tree4TimeAlive = -1L;
        } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (!this.tree4Status))
        {
          this.tree4Status = true;
          this.tree4AliveTime = System.currentTimeMillis();
          this.tree4TimeDead = -1L;
        } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree4Status = true;
          this.tree4TimeAlive = (System.currentTimeMillis() - this.tree4AliveTime);
        }
        else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree4Status = false;
          this.tree4TimeDead = (System.currentTimeMillis() - this.tree4DeadTime);
        }
      }
    }
    else
    {
      this.tree4Status = false;
      this.tree4TimeDead = 0L;
      this.tree4TimeAlive = 0L;
    }
    if (this.tree5.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree5);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (this.tree5Status)) {
          this.tree5Status = false;
          this.tree5DeadTime = System.currentTimeMillis();
          this.tree5TimeAlive = -1L;
        } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (!this.tree5Status))
        {
          this.tree5Status = true;
          this.tree5AliveTime = System.currentTimeMillis();
          this.tree5TimeDead = -1L;
        } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree5Status = true;
          this.tree5TimeAlive = (System.currentTimeMillis() - this.tree5AliveTime);
        }
        else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree5Status = false;
          this.tree5TimeDead = (System.currentTimeMillis() - this.tree5DeadTime);
        }
      }
    }
    else
    {
      this.tree5Status = false;
      this.tree5TimeDead = 0L;
      this.tree5TimeAlive = 0L;
    }
    if (this.tree6.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree6);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (this.tree6Status)) {
          this.tree6Status = false;
          this.tree6DeadTime = System.currentTimeMillis();
          this.tree6TimeAlive = -1L;
        } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (!this.tree6Status))
        {
          this.tree6Status = true;
          this.tree6AliveTime = System.currentTimeMillis();
          this.tree6TimeDead = -1L;
        } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree6Status = true;
          this.tree6TimeAlive = (System.currentTimeMillis() - this.tree6AliveTime);
        }
        else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree6Status = false;
          this.tree6TimeDead = (System.currentTimeMillis() - this.tree6DeadTime);
        }
      }
    }
    else
    {
      this.tree6Status = false;
      this.tree6TimeDead = 0L;
      this.tree6TimeAlive = 0L;
    }
    if (this.tree7.getX() != 0) {
      arrayOfRSObject3 = this.objects.getAllAt(this.tree7);

      for (k = 0; k < arrayOfRSObject3.length; k++) {
        if ((this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (this.tree7Status)) {
          this.tree7Status = false;
          this.tree7DeadTime = System.currentTimeMillis();
          this.tree7TimeAlive = -1L;
        } else if ((this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) && (!this.tree7Status))
        {
          this.tree7Status = true;
          this.tree7AliveTime = System.currentTimeMillis();
          this.tree7TimeDead = -1L;
        } else if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree7Status = true;
          this.tree7TimeAlive = (System.currentTimeMillis() - this.tree7AliveTime);
        }
        else if (this.stumpIDs.contains(Integer.valueOf(arrayOfRSObject3[k].getID()))) {
          this.tree7Status = false;
          this.tree7TimeDead = (System.currentTimeMillis() - this.tree7DeadTime);
        }
      }
    }
    else
    {
      this.tree7Status = false;
      this.tree7TimeDead = 0L;
      this.tree7TimeAlive = 0L;
    }
  }

  public void calculateNextTree()
  {
    int m;
    if ((!this.tree7Status) && (!this.tree6Status) && (!this.tree5Status) && (!this.tree4Status) && (!this.tree3Status) && (!this.tree2Status) && (!this.tree1Status))
    {
      long l1 = -2L;
      int i = -1;
      long[] arrayOfLong1 = { this.tree1TimeDead, this.tree2TimeDead, this.tree3TimeDead, this.tree4TimeDead, this.tree5TimeDead, this.tree6TimeDead, this.tree7TimeDead };

      for (m = 0; m < arrayOfLong1.length; m++) {
        if (arrayOfLong1[m] >= l1) {
          i = m;
          l1 = arrayOfLong1[m];
        }
      }
      this.nextTree = (i + 1);
    }
    else
    {
      int n;
      if (this.nearest) {
        RSTile[] arrayOfRSTile = { this.tree1, this.tree2, this.tree3, this.tree4, this.tree5, this.tree6, this.tree7 };
        int[] arrayOfInt = new int[7];
        boolean[] arrayOfBoolean = { this.tree1Status, this.tree2Status, this.tree3Status, this.tree4Status, this.tree5Status, this.tree6Status, this.tree7Status };

        for (int k = 0; k < arrayOfBoolean.length; k++)
          if (arrayOfBoolean[k] != 0)
            arrayOfInt[k] = distanceTo(arrayOfRSTile[k]);
          else
            arrayOfInt[k] = 500;
        k = 500;
        m = -1;
        if (!this.status.equals("Chopping!")) {
          for (n = 0; n < arrayOfInt.length; n++)
            if (arrayOfInt[n] < k) {
              m = n;
              k = arrayOfInt[n];
            }
        } else {
          k = 499;
          n = -1;
          for (int i1 = 0; i1 < arrayOfInt.length; i1++) {
            if ((arrayOfInt[i1] < k) && (k == 499)) {
              n = i1;
              k = arrayOfInt[i1];
            } else if ((arrayOfInt[i1] < k) && (k != 499)) {
              m = n;
              n = i1;
            }
          }
        }
        this.nextTree = (m + 1);
      } else {
        long l2 = -2L;
        int j = -1;
        long[] arrayOfLong2 = { this.tree1TimeAlive, this.tree2TimeAlive, this.tree3TimeAlive, this.tree4TimeAlive, this.tree5TimeAlive, this.tree6TimeAlive, this.tree7TimeAlive };

        if (!this.status.equals("Chopping!")) {
          for (m = 0; m < arrayOfLong2.length; m++)
            if (arrayOfLong2[m] >= l2) {
              j = m;
              l2 = arrayOfLong2[m];
            }
        }
        else {
          m = -1;
          for (n = 0; n < arrayOfLong2.length; n++) {
            if ((arrayOfLong2[n] >= l2) && (l2 == -2L)) {
              m = n;
              l2 = arrayOfLong2[n];
            } else if (arrayOfLong2[n] >= l2) {
              j = m;
              m = n;
            }
          }
        }
        this.nextTree = (j + 1);
      }
    }
  }

  public RSObject getNextTree()
  {
    RSObject[] arrayOfRSObject;
    int i;
    if ((!this.treeType.equals("ivy")) && (!this.treeType.equals("willows"))) {
      arrayOfRSObject = new RSObject[10];
      if (this.nextTree == 1)
        arrayOfRSObject = this.objects.getAllAt(this.tree1);
      if (this.nextTree == 2)
        arrayOfRSObject = this.objects.getAllAt(this.tree2);
      if (this.nextTree == 3)
        arrayOfRSObject = this.objects.getAllAt(this.tree3);
      if (this.nextTree == 4)
        arrayOfRSObject = this.objects.getAllAt(this.tree4);
      if (this.nextTree == 5)
        arrayOfRSObject = this.objects.getAllAt(this.tree5);
      if (this.nextTree == 6)
        arrayOfRSObject = this.objects.getAllAt(this.tree6);
      if (this.nextTree == 7)
        arrayOfRSObject = this.objects.getAllAt(this.tree7);
      for (i = 0; i < arrayOfRSObject.length; i++)
        if (arrayOfRSObject[i].getID() == this.treeID)
          return arrayOfRSObject[i];
    } else {
      arrayOfRSObject = new RSObject[10];
      if (this.nextTree == 1)
        arrayOfRSObject = this.objects.getAllAt(this.tree1);
      if (this.nextTree == 2)
        arrayOfRSObject = this.objects.getAllAt(this.tree2);
      if (this.nextTree == 3)
        arrayOfRSObject = this.objects.getAllAt(this.tree3);
      if (this.nextTree == 4)
        arrayOfRSObject = this.objects.getAllAt(this.tree4);
      if (this.nextTree == 5)
        arrayOfRSObject = this.objects.getAllAt(this.tree5);
      if (this.nextTree == 6)
        arrayOfRSObject = this.objects.getAllAt(this.tree6);
      if (this.nextTree == 7)
        arrayOfRSObject = this.objects.getAllAt(this.tree7);
      for (i = 0; i < arrayOfRSObject.length; i++)
        if (this.ivyIDs.contains(Integer.valueOf(arrayOfRSObject[i].getID())))
          return arrayOfRSObject[i];
    }
    return null;
  }

  public RSTile getMidTile(RSTile paramRSTile1, RSTile paramRSTile2) {
    int i = paramRSTile1.getX();
    int j = paramRSTile1.getY();
    int k = paramRSTile2.getX();
    int m = paramRSTile2.getY();

    return new RSTile((i + k) / 2, (j + m) / 2);
  }

  public void moveToNextTree() {
    this.status = ("Moving to tree: " + this.nextTree);
    RSTile[] arrayOfRSTile = { this.tree1, this.tree2, this.tree3, this.tree4, this.tree5, this.tree6, this.tree7 };
    RSTile localRSTile = getMidTile(this.players.getMyPlayer().getLocation(), arrayOfRSTile[(this.nextTree - 1)]);

    if ((!this.walking.isRunEnabled()) && (this.walking.getEnergy() > 20)) {
      this.walking.setRun(true);
      sleep(random(600, 800));
    }
    if ((this.command.equals("South Falador - Yews")) || (this.command.equals("Draynor - Yews")))
    {
      moveToNextTreeLong();
    } else if (this.command.equals("Edgeville - Yews")) {
      if ((this.nextTree == 1) && (this.calc.tileOnMap(this.tree1)))
        localRSTile = new RSTile(this.tree1.getX(), this.tree1.getY() - 2);
      if ((this.nextTree == 2) && (this.calc.tileOnMap(this.tree2)))
        localRSTile = new RSTile(this.tree2.getX(), this.tree2.getY() + 2);
    } else if (this.command.equals("Grand Exchange - Yews")) {
      if ((this.nextTree == 1) && (this.calc.tileOnMap(this.tree1)))
        localRSTile = new RSTile(this.tree1.getX() + 2, this.tree1.getY());
      if ((this.nextTree == 2) && (this.calc.tileOnMap(this.tree2)))
        localRSTile = new RSTile(this.tree2.getX(), this.tree2.getY());
      if ((this.nextTree == 3) && (this.calc.tileOnMap(this.tree3)))
        localRSTile = new RSTile(this.tree3.getX() - 2, this.tree2.getY());
    } else if (this.command.equals("Catherby - Yews")) {
      if ((this.nextTree == 1) && (this.calc.tileOnMap(this.tree1)))
        localRSTile = new RSTile(this.tree1.getX(), this.tree1.getY() - 2);
      if ((this.nextTree == 2) && (this.calc.tileOnMap(this.tree2)))
        localRSTile = new RSTile(this.tree2.getX(), this.tree2.getY() - 2);
      if ((this.nextTree == 3) && (this.calc.tileOnMap(this.tree3)))
        localRSTile = new RSTile(this.tree3.getX(), this.tree3.getY() - 2);
      if ((this.nextTree == 4) && (this.calc.tileOnMap(this.tree4)))
        localRSTile = new RSTile(this.tree4.getX(), this.tree4.getY() - 2);
      if ((this.nextTree == 5) && (this.calc.tileOnMap(this.tree5)))
        localRSTile = new RSTile(this.tree5.getX(), this.tree5.getY() - 2);
      if ((this.nextTree == 6) && (this.calc.tileOnMap(this.tree6)))
        localRSTile = new RSTile(this.tree6.getX(), this.tree6.getY() - 2);
      if ((this.nextTree == 7) && (this.calc.tileOnMap(this.tree7)))
        localRSTile = new RSTile(this.tree7.getX(), this.tree7.getY() - 2);
    } else if (this.command.equals("Catherby - Yews")) {
      if ((this.nextTree == 1) && (this.calc.tileOnMap(this.tree1)))
        localRSTile = new RSTile(this.tree1.getX() - 1, this.tree1.getY() + 2);
      if ((this.nextTree == 2) && (this.calc.tileOnMap(this.tree2)))
        localRSTile = new RSTile(this.tree2.getX(), this.tree2.getY() + 2);
      if ((this.nextTree == 3) && (this.calc.tileOnMap(this.tree3)))
        localRSTile = new RSTile(this.tree3.getX(), this.tree2.getY() - 2);
    } else {
      if ((this.nextTree == 1) && (this.calc.tileOnMap(this.tree1)))
        localRSTile = this.tree1;
      if ((this.nextTree == 2) && (this.calc.tileOnMap(this.tree2)))
        localRSTile = this.tree2;
      if ((this.nextTree == 3) && (this.calc.tileOnMap(this.tree3)))
        localRSTile = this.tree3;
      if ((this.nextTree == 4) && (this.calc.tileOnMap(this.tree4)))
        localRSTile = this.tree4;
      if ((this.nextTree == 5) && (this.calc.tileOnMap(this.tree5)))
        localRSTile = this.tree5;
      if ((this.nextTree == 6) && (this.calc.tileOnMap(this.tree6)))
        localRSTile = this.tree6;
      if ((this.nextTree == 7) && (this.calc.tileOnMap(this.tree7)))
        localRSTile = this.tree7;
    }
    if ((!this.command.equals("South Falador - Yews")) && (!this.command.equals("Draynor - Yews")))
    {
      int i = 0;
      if ((this.calc.tileOnScreen(localRSTile)) && (!this.command.equals("Mage Training Area - Magics")))
      {
        if (this.walking.walkTileOnScreen(localRSTile))
          i = 1;
      } else if (this.walking.walkTileMM(localRSTile))
        i = 1;
      if ((this.command.equals("Mage Training Area - Magics")) && (i != 0))
        while (getMyPlayer().isMoving())
          sleep(random(600, 800));
      sleep(random(600, 800));
      if (i != 0) {
        long l = System.currentTimeMillis();
        while ((!playerIsNear(arrayOfRSTile[(this.nextTree - 1)], 4)) && 
          (System.currentTimeMillis() - l <= 2000L))
        {
          if ((System.currentTimeMillis() - l > random(600, 800)) && (!getMyPlayer().isMoving()))
          {
            this.walking.walkTileMM(localRSTile);
          }sleep(random(100, 200));
        }
        if (!playerIsNear(arrayOfRSTile[(this.nextTree - 1)], 4))
          this.walking.walkTileMM(localRSTile);
      }
    }
  }

  public void moveToNextTreeLong() {
    RSTile[] arrayOfRSTile1 = { this.tree1, this.tree2, this.tree3, this.tree4, this.tree5, this.tree6, this.tree7 };
    long l = System.currentTimeMillis();
    RSTile[] arrayOfRSTile2;
    RSTile[] arrayOfRSTile3;
    RSTile[] arrayOfRSTile4;
    RSTile[] arrayOfRSTile5;
    RSTile[] arrayOfRSTile6;
    RSTile[] arrayOfRSTile7;
    Object localObject;
    if (this.location.equals("South Falador")) {
      arrayOfRSTile2 = new RSTile[] { this.tree1, new RSTile(3007, 3318), this.tree2, new RSTile(3030, 3321), this.tree3 };

      arrayOfRSTile3 = this.walking.reversePath(arrayOfRSTile2);
      arrayOfRSTile4 = new RSTile[] { this.tree1, new RSTile(3007, 3318), this.tree2 };
      arrayOfRSTile5 = this.walking.reversePath(arrayOfRSTile4);
      arrayOfRSTile6 = new RSTile[] { this.tree2, new RSTile(3030, 3321), this.tree3 };
      arrayOfRSTile7 = this.walking.reversePath(arrayOfRSTile6);

      localObject = new RSTile[][] { arrayOfRSTile2, arrayOfRSTile3, arrayOfRSTile4, arrayOfRSTile5, arrayOfRSTile6, arrayOfRSTile7 };

      int i = -1;
      if ((this.nextTree == 1) && (!atTrees()))
        i = 1;
      if ((this.nextTree == 1) && (atTrees()))
        i = 3;
      else if ((this.nextTree == 2) && (playerIsNear(this.tree3, 4)))
        i = 5;
      else if ((this.nextTree == 2) && (playerIsNear(this.tree1, 4)))
        i = 2;
      else if (this.nextTree == 3)
        i = 0;
      else if (this.nextTree == 2) {
        i = 2;
      }
      if (i >= 0) {
        this.status = ("Moving to tree: " + this.nextTree);
        int j = -1;
        int k = walkPath(localObject[i]);
        int m = 0;

        while ((!playerIsNear(arrayOfRSTile1[(this.nextTree - 1)], 4)) && (System.currentTimeMillis() - l < 20000L)) {
          boolean bool1 = false;
          k = walkPath(localObject[i]);
          if (m == 0) {
            if (k > j) {
              if (this.calc.tileOnScreen(localObject[i][k])) {
                if (!this.walking.walkTileOnScreen(localObject[i][k]))
                {
                  if (this.walking.walkTileMM(localObject[i][k], 1, 1))
                  {
                    bool1 = true;
                  }
                  else bool1 = false; 
                }
                else
                  bool1 = true;
              }
              else bool1 = this.walking.walkTileMM(localObject[i][k], 1, 1);

            }

            if (bool1) {
              j = k;
              if (k == localObject[i].length - 1) {
                m = 1;
              }
            }
          }
          sleep(random(200, 300));
        }
      }
    }
    if (this.location.equals("Draynor")) {
      arrayOfRSTile2 = new RSTile[] { this.tree1, new RSTile(3149, 3244), this.tree2 };
      arrayOfRSTile3 = this.walking.reversePath(arrayOfRSTile2);
      arrayOfRSTile4 = new RSTile[] { this.tree2, new RSTile(3161, 3222), this.tree3 };
      arrayOfRSTile5 = this.walking.reversePath(arrayOfRSTile4);
      arrayOfRSTile6 = new RSTile[] { this.tree3, new RSTile(3176, 3224), this.tree4 };
      arrayOfRSTile7 = this.walking.reversePath(arrayOfRSTile6);
      localObject = new RSTile[] { this.tree2, new RSTile(3162, 3227), new RSTile(3171, 3227), this.tree4 };

      RSTile[] arrayOfRSTile8 = this.walking.reversePath(localObject);
      RSTile[] arrayOfRSTile9 = { this.tree1, new RSTile(3151, 3248), new RSTile(3153, 3241), new RSTile(3161, 3228), this.tree3 };

      RSTile[] arrayOfRSTile10 = this.walking.reversePath(arrayOfRSTile9);
      RSTile[] arrayOfRSTile11 = { this.tree1, new RSTile(3156, 3244), new RSTile(3165, 3235), new RSTile(3175, 3229), this.tree4 };

      RSTile[] arrayOfRSTile12 = this.walking.reversePath(arrayOfRSTile11);

      RSTile[][] arrayOfRSTile; = { arrayOfRSTile2, arrayOfRSTile3, arrayOfRSTile4, arrayOfRSTile5, arrayOfRSTile6, arrayOfRSTile7, localObject, arrayOfRSTile8, arrayOfRSTile9, arrayOfRSTile10, arrayOfRSTile11, arrayOfRSTile12 };

      int n = -1;
      this.status = ("Moving to tree: " + this.nextTree);
      if ((this.nextTree == 1) && (playerIsNear(this.tree3, 4)))
        n = 9;
      else if ((this.nextTree == 1) && (playerIsNear(this.tree2, 4)))
        n = 1;
      else if ((this.nextTree == 2) && (playerIsNear(this.tree3, 4)))
        n = 3;
      else if ((this.nextTree == 2) && (playerIsNear(this.tree1, 4)))
        n = 0;
      else if ((this.nextTree == 3) && (playerIsNear(this.tree1, 4)))
        n = 8;
      else if ((this.nextTree == 3) && (playerIsNear(this.tree2, 4)))
        n = 2;
      else if ((this.nextTree == 4) && (playerIsNear(this.tree3, 4)))
        n = 4;
      else if ((this.nextTree == 3) && (playerIsNear(this.tree4, 4)))
        n = 5;
      else if ((this.nextTree == 4) && (playerIsNear(this.tree2, 4)))
        n = 6;
      else if ((this.nextTree == 2) && (playerIsNear(this.tree4, 4)))
        n = 7;
      else if ((this.nextTree == 4) && (playerIsNear(this.tree1, 4)))
        n = 10;
      else if ((this.nextTree == 1) && (playerIsNear(this.tree4, 4)))
        n = 11;
      else if (playerIsNear(new RSTile(3149, 3237), 4))
        n = 0;
      else if (playerIsNear(new RSTile(3161, 3222), 4))
        n = 2;
      else if (playerIsNear(new RSTile(3176, 3224), 4))
        n = 4;
      else if ((playerIsNear(new RSTile(3171, 3227), 4)) || (playerIsNear(new RSTile(3162, 3227), 4)))
      {
        n = 6;
      } else if ((playerIsNear(new RSTile(3151, 3248), 4)) || (playerIsNear(new RSTile(3153, 3241), 4)) || (playerIsNear(new RSTile(3161, 3228), 4)))
      {
        n = 8;
      } else if ((playerIsNear(new RSTile(3156, 3240), 4)) || (playerIsNear(new RSTile(3166, 3232), 4)) || (playerIsNear(new RSTile(3176, 3229), 4)))
      {
        n = 10;
      }
      if (n >= 0) {
        int i1 = -1;
        int i2 = walkPath(arrayOfRSTile;[n]);
        int i3 = 0;

        while ((!playerIsNear(arrayOfRSTile1[(this.nextTree - 1)], 4)) && (System.currentTimeMillis() - l < 20000L)) {
          boolean bool2 = false;
          i2 = walkPath(arrayOfRSTile;[n]);
          if (i3 == 0) {
            if (i2 > i1) {
              if (this.calc.tileOnScreen(arrayOfRSTile;[n][i2])) {
                if (!this.walking.walkTileOnScreen(arrayOfRSTile;[n][i2]))
                {
                  if (this.walking.walkTileMM(arrayOfRSTile;[n][i2], 1, 1))
                  {
                    bool2 = true;
                  }
                  else bool2 = false; 
                }
                else
                  bool2 = true;
              }
              else bool2 = this.walking.walkTileMM(arrayOfRSTile;[n][i2], 1, 1);

            }

            if (bool2) {
              i1 = i2;
              if (i2 == arrayOfRSTile;[n].length - 1) {
                i3 = 1;
              }
            }
          }
          sleep(random(200, 300));
        }
      }
    }
  }

  public void chop(boolean paramBoolean) {
    this.safety = 1;
    RSObject localRSObject = getNextTree();
    RSModel localRSModel = localRSObject.getModel();

    if ((!paramBoolean) && (this.treeType.equals("ivy")))
    {
      if ((this.command.equals("Castle Wars - Ivy")) || (this.command.equals("South Falador - Ivy")))
      {
        int i = random(1, 2);
        if (i == 1)
          this.camera.setAngle(random(1, 30));
        if (i == 2)
          this.camera.setAngle(random(340, 359));
      }
      if ((this.command.equals("Grand Exchange - Ivy")) || (this.command.equals("Yanille - Ivy")) || (this.command.equals("North Falador - Ivy")))
      {
        this.camera.setAngle(random(170, 190));
      }
      if ((this.command.equals("Taverly - Ivy")) || (this.command.equals("Varrock Palace - Ivy")))
      {
        this.camera.setAngle(random(260, 280));
      }
      if (this.command.equals("Ardougne - Ivy")) {
        this.camera.setAngle(random(80, 100));
      }
    }
    Point localPoint = localRSModel.getPoint();
    this.mouse.move(localPoint);
    if (this.treeType.equals("yews"))
      this.menu.doAction("Chop down Yew");
    else if (this.treeType.equals("magics"))
      this.menu.doAction("Chop down Magic tree");
    else if (this.treeType.equals("ivy"))
      this.menu.doAction("Chop Ivy");
    else if (this.treeType.equals("willows"))
      this.menu.doAction("Chop down Willow");
    else if (this.treeType.equals("maples"))
      this.menu.doAction("Chop down Maple tree");
    else if (this.treeType.equals("oaks")) {
      this.menu.doAction("Chop down Oak");
    }
    sleep(random(600, 800));
    while (this.players.getMyPlayer().isMoving()) {
      sleep(random(100, 200));
    }
    if ((!chopCheck()) && (!paramBoolean))
      chop(true);
  }

  public void hoverMouse() {
    if (!this.players.getMyPlayer().isMoving()) {
      RSTile[] arrayOfRSTile = { this.tree1, this.tree2, this.tree3, this.tree4, this.tree5, this.tree6, this.tree7 };
      if (this.calc.tileOnScreen(arrayOfRSTile[(this.nextTree - 1)])) {
        Point localPoint = this.calc.tileToScreen(arrayOfRSTile[(this.nextTree - 1)]);
        try {
          if (localPoint.getY() - 50.0D > 1.0D) {
            this.mouse.move(new Point((int)localPoint.getX(), (int)localPoint.getY() - 50), 1, 1);
          }
          else
          {
            this.mouse.move(new Point((int)localPoint.getX(), (int)localPoint.getY()), 1, 1);
          }
        }
        catch (Exception localException)
        {
        }
      }
    }
  }

  public boolean atBank() {
    if ((this.command.equals("Grand Exchange - Yews")) || (this.command.equals("Grand Exchange - Ivy")))
    {
      if ((getMyPlayer().getLocation().getX() >= 3171) || (getMyPlayer().getLocation().getX() < 3167))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3486) && (getMyPlayer().getLocation().getY() <= 3492))
      {
        return true;
      }
    }
    if (this.command.equals("Edgeville - Yews")) {
      if ((getMyPlayer().getLocation().getX() >= 3096) || (getMyPlayer().getLocation().getX() < 3091))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3488) && (getMyPlayer().getLocation().getY() <= 3494))
      {
        return true;
      }
    }
    if ((this.command.equals("South Falador - Yews")) || (this.command.equals("South Falador - Ivy")))
    {
      if ((getMyPlayer().getLocation().getX() >= 3016) || (getMyPlayer().getLocation().getX() < 3010))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3355) && (getMyPlayer().getLocation().getY() <= 3359))
      {
        return true;
      }
    }
    if ((this.command.equals("Rimmington - Yews")) || (this.command.equals("Port Salim - Willows")))
    {
      return (getMyPlayer().getLocation().getX() >= 3045) && (getMyPlayer().getLocation().getY() <= 3237) && (getMyPlayer().getLocation().getY() >= 3234);
    }

    if (this.command.equals("Catherby - Yews")) {
      if ((getMyPlayer().getLocation().getX() > 2811) || (getMyPlayer().getLocation().getX() < 2807))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3439) && (getMyPlayer().getLocation().getY() <= 3441))
      {
        return true;
      }
    }
    if (this.command.equals("Tree Gnome - Yews")) {
      if ((getMyPlayer().getLocation().getX() > 2446) || (getMyPlayer().getLocation().getX() < 2445))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3423) && (getMyPlayer().getLocation().getY() <= 3428))
      {
        return true;
      }
    }
    if ((this.location.equals("Seer's Village")) || (this.command.equals("Sorcerer's Tower - Magics")))
    {
      if ((getMyPlayer().getLocation().getX() < 2724) || (getMyPlayer().getLocation().getX() > 2728))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3491) && (getMyPlayer().getLocation().getY() <= 3495))
      {
        return true;
      }
    }
    if (this.command.equals("Mage Training Area - Magics")) {
      return playerIsNear(this.bankLocation, 5);
    }
    if (this.command.equals("Castle Wars - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2445) || (getMyPlayer().getLocation().getX() < 3086))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3083) && (getMyPlayer().getLocation().getY() <= 3086))
      {
        return true;
      }
    }
    if (this.command.equals("Yanille - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2614) || (getMyPlayer().getLocation().getX() < 2611))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3092) && (getMyPlayer().getLocation().getY() <= 3095))
      {
        return true;
      }
    }
    if (this.command.equals("Ardougne - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2616) || (getMyPlayer().getLocation().getX() < 2613))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3332) && (getMyPlayer().getLocation().getY() <= 3334))
      {
        return true;
      }
    }
    if (this.command.equals("Varrock Palace - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 3255) || (getMyPlayer().getLocation().getX() < 3250))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3252) && (getMyPlayer().getLocation().getY() <= 3422))
      {
        return true;
      }
    }
    if (this.command.equals("North Falador - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2948) || (getMyPlayer().getLocation().getX() < 2944))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3368) && (getMyPlayer().getLocation().getY() <= 3371))
      {
        return true;
      }
    }
    if (this.location.equals("Draynor")) {
      if ((getMyPlayer().getLocation().getX() >= 3094) || (getMyPlayer().getLocation().getX() < 3092))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3244) && (getMyPlayer().getLocation().getY() <= 3246))
      {
        return true;
      }
    }
    return false;
  }

  public boolean atTrees() {
    if (this.command.equals("Draynor - Oaks"))
      return (playerIsNear(this.tree1, 4)) || (playerIsNear(this.tree2, 4));
    if (this.command.equals("Grand Exchange - Yews")) {
      if ((getMyPlayer().getLocation().getX() < 3203) || (getMyPlayer().getLocation().getX() > 3222))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3500) && (getMyPlayer().getLocation().getY() <= 3505))
      {
        return true;
      }
    }
    if (this.command.equals("Edgeville - Yews")) {
      if ((getMyPlayer().getLocation().getX() >= 3090) || (getMyPlayer().getLocation().getX() < 3085))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3468) && (getMyPlayer().getLocation().getY() <= 3482))
      {
        return true;
      }
    }
    if (this.command.equals("Rimmington - Yews")) {
      if ((getMyPlayer().getLocation().getX() >= 2942) || (getMyPlayer().getLocation().getX() < 2932))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3225) && (getMyPlayer().getLocation().getY() <= 3236))
      {
        return true;
      }
    }
    if (this.command.equals("Catherby - Yews")) {
      if ((getMyPlayer().getLocation().getX() >= 2769) || (getMyPlayer().getLocation().getX() < 2751))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3427) && (getMyPlayer().getLocation().getY() <= 3438))
      {
        return true;
      }
    }
    if (this.command.equals("Seer's Village - Yews")) {
      if ((getMyPlayer().getLocation().getX() >= 2717) || (getMyPlayer().getLocation().getX() < 2712))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3462) && (getMyPlayer().getLocation().getY() <= 3464))
      {
        return true;
      }
    }
    if (this.command.equals("South Falador - Yews")) {
      if ((getMyPlayer().getLocation().getX() >= 3010) || (getMyPlayer().getLocation().getX() < 3004))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3317) && (getMyPlayer().getLocation().getY() <= 3325))
      {
        return true;
      }
    }
    if (this.command.equals("Draynor - Yews")) {
      return playerIsNear(this.tree2, 5);
    }
    if (this.command.equals("Tree Gnome - Yews")) {
      return (floorHeight() == 0) && (playerIsNear(new RSTile(2444, 3434), 5));
    }

    if (this.command.equals("Seer's Village - Magics")) {
      if ((getMyPlayer().getLocation().getX() < 2690) || (getMyPlayer().getLocation().getX() > 2699))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3422) && (getMyPlayer().getLocation().getY() <= 3426))
      {
        return true;
      }
    }
    if (this.command.equals("Sorcerer's Tower - Magics")) {
      if ((getMyPlayer().getLocation().getX() > 2704) || (getMyPlayer().getLocation().getX() < 2700))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3396) && (getMyPlayer().getLocation().getY() <= 3400))
      {
        return true;
      }
    }
    if (this.command.equals("Mage Training Area - Magics")) {
      if ((getMyPlayer().getLocation().getX() > 3365) || (getMyPlayer().getLocation().getX() < 3361))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3296) && (getMyPlayer().getLocation().getY() <= 3300))
      {
        return true;
      }
    }
    if (this.command.equals("Castle Wars - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2431) || (getMyPlayer().getLocation().getX() < 2423))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3067) && (getMyPlayer().getLocation().getY() <= 3068))
      {
        return true;
      }
    }
    if (this.command.equals("Grand Exchange - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 3220) || (getMyPlayer().getLocation().getX() < 3215))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3498) && (getMyPlayer().getLocation().getY() <= 3502))
      {
        return true;
      }
    }
    if (this.command.equals("Yanille - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2599) || (getMyPlayer().getLocation().getX() < 2594))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3111) && (getMyPlayer().getLocation().getY() <= 3112))
      {
        return true;
      }
    }
    if (this.command.equals("Ardougne - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 2624) || (getMyPlayer().getLocation().getX() < 2622))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3304) && (getMyPlayer().getLocation().getY() <= 3310))
      {
        return true;
      }
    }
    if (this.command.equals("Varrock Palace - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 3234) || (getMyPlayer().getLocation().getX() < 3232))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3456) && (getMyPlayer().getLocation().getY() <= 3461))
      {
        return true;
      }
    }
    if (this.command.equals("South Falador - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 3053) || (getMyPlayer().getLocation().getX() < 3044))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3326) && (getMyPlayer().getLocation().getY() <= 3328))
      {
        return true;
      }
    }
    if (this.command.equals("North Falador - Ivy")) {
      if ((getMyPlayer().getLocation().getX() >= 3019) || (getMyPlayer().getLocation().getX() < 3010))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3392) && (getMyPlayer().getLocation().getY() <= 3394))
      {
        return true;
      }
    }
    if (this.command.equals("Draynor - Willows")) {
      if ((getMyPlayer().getLocation().getX() >= 3092) || (getMyPlayer().getLocation().getX() < 3083))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3233) && (getMyPlayer().getLocation().getY() <= 3239))
      {
        return true;
      }
    }
    if (this.command.equals("Port Salim - Willows")) {
      if ((getMyPlayer().getLocation().getX() >= 3064) || (getMyPlayer().getLocation().getX() < 3056))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3250) && (getMyPlayer().getLocation().getY() <= 3256))
      {
        return true;
      }
    }
    if (this.command.equals("Seer's Village - Maples")) {
      if ((getMyPlayer().getLocation().getX() >= 2731) || (getMyPlayer().getLocation().getX() < 2727))
      {
        return false;
      }if ((getMyPlayer().getLocation().getY() >= 3499) && (getMyPlayer().getLocation().getY() <= 3502))
      {
        return true;
      }
    }
    return false;
  }

  public void gate() {
    if (this.calc.tileToScreen(new RSTile(3348, 3279)).x != -1) {
      RSObject localRSObject = getGate();
      while (isGateClosed()) {
        this.status = "Opening gate.";
        this.walking.walkTileMM(new RSTile(3348, 3279), 1, 1);
        RSModel localRSModel = localRSObject.getModel();
        Point localPoint = localRSModel.getPoint();
        this.mouse.move(localPoint, 1, 1);
        if (this.menu.doAction("Open Gate"))
          this.status = "Gate opened.";
        sleep(random(1000, 1200));
      }
    }
  }

  public boolean isGateClosed() {
    RSObject[] arrayOfRSObject = this.objects.getAllAt(new RSTile(3348, 3279));
    for (int i = 0; i < arrayOfRSObject.length; i++) {
      if (arrayOfRSObject[i].getID() == 27852) {
        return true;
      }
    }
    return false;
  }

  public RSObject getGate() {
    RSObject[] arrayOfRSObject = this.objects.getAllAt(new RSTile(3348, 3279));
    RSObject localRSObject = null;
    for (int i = 0; i < arrayOfRSObject.length; i++) {
      if (arrayOfRSObject[i].getID() == 27852) {
        localRSObject = arrayOfRSObject[i];
      }
    }
    return localRSObject;
  }

  public void walkToBank() {
    System.currentTimeMillis();
    this.status = "Walking to bank.";
    if (random(1, 3) == 2)
      this.camera.setPitch(true);
    int i = -1;
    int j = 0;
    while (!atBank()) {
      if ((!this.walking.isRunEnabled()) && (this.walking.getEnergy() > 20)) {
        this.walking.setRun(true);
        sleep(random(600, 800));
      }
      this.status = "Walking to bank..";
      if (this.command.equals("Mage Training Area - Magics")) {
        gate();
      }
      if ((this.command.equals("Rimmington - Yews")) && 
        (!getMyPlayer().isMoving()) && (
        (playerIsNear(new RSTile(2933, 3236), 3)) || (playerIsNear(this.tree4, 3))))
      {
        this.walking.walkTileMM(this.treesToBank[0], 1, 1);
        sleep(random(600, 800));
        while (getMyPlayer().isMoving()) {
          sleep(random(100, 200));
        }
      }
      if ((this.command.equals("South Falador - Yews")) && 
        (playerIsNear(this.tree3, 4))) {
        this.walking.walkTileMM(new RSTile(3030, 3321), 1, 1);
        while (this.calc.tileToMinimap(this.tree2).getX() == -1.0D) {
          sleep(random(100, 200));
        }
        this.walking.walkTileMM(this.tree2, 1, 1);
        sleep(random(1200, 1500));
        while (this.players.getMyPlayer().isMoving()) {
          sleep(random(100, 200));
        }
      }

      if ((this.command.equals("Tree Gnome - Yews")) && 
        (floorHeight() == 0)) {
        if (!playerIsNear(new RSTile(2444, 3434), 4)) {
          this.walking.walkTileMM(new RSTile(2444, 3434));
          while (getMyPlayer().isMoving())
            sleep(random(100, 200));
        }
        for (k = 0; k < 3; k++) {
          Object localObject = null;
          RSObject[] arrayOfRSObject = this.objects.getAllAt(new RSTile(2446, 3435));

          for (int m = 0; m < arrayOfRSObject.length; m++) {
            if (arrayOfRSObject[m].getID() == 1742)
              localObject = arrayOfRSObject[m];
          }
          if (localObject != null) {
            RSModel localRSModel = localObject.getModel();
            Point localPoint = localRSModel.getPoint();
            this.mouse.move(localPoint);
            this.mouse.click(true);
            sleep(random(1000, 1500));
          }
        }
        if (floorHeight() == 1)
        {
          break;
        }
      }
      if ((this.command.equals("Grand Exchange - Yews")) && 
        (playerIsNear(this.tree3, 5))) {
        this.walking.walkTileMM(this.tree2);
        sleep(random(600, 800));
      }

      if (!getMyPlayer().isMoving()) {
        sleep(random(600, 800));
        if (!getMyPlayer().isMoving())
          i = -1;
      }
      int k = 0;
      j = walkPath(this.treesToBank);
      if (j > i) {
        if (this.walking.walkTileMM(this.treesToBank[j], 1, 1))
          k = 1;
        sleep(random(400, 500));
        if (getMyPlayer().isMoving())
          k = 1;
      }
      if (k != 0) {
        i = j;
      }
      sleep(random(200, 300));
    }
  }

  public boolean compareTiles(RSTile paramRSTile1, RSTile paramRSTile2) {
    return (paramRSTile1.getX() == paramRSTile2.getX()) && (paramRSTile1.getY() == paramRSTile2.getY());
  }

  public int walkPath(RSTile[] paramArrayOfRSTile)
  {
    int i = 0;
    int j = 0;
    int m;
    for (int k = 0; k < paramArrayOfRSTile.length; k++) {
      if (playerIsNear(paramArrayOfRSTile[k], 5)) {
        j = 1;
        i = k + 1;
        antiBan(random(1, 200));
        for (m = k; m < paramArrayOfRSTile.length; m++) {
          if (this.calc.tileToMinimap(paramArrayOfRSTile[m]).x < 0) {
            i = m - 1;
            break;
          }
          if ((m != paramArrayOfRSTile.length - 1) || (this.calc.tileToMinimap(paramArrayOfRSTile[m]).x <= 0))
            continue;
          i = m;
          break;
        }

        return i;
      }
    }
    if (j == 0) {
      RSTile localRSTile = this.walking.nextTile(paramArrayOfRSTile);
      for (m = 0; m < paramArrayOfRSTile.length; m++) {
        if (compareTiles(paramArrayOfRSTile[m], localRSTile)) {
          return m;
        }
      }
    }
    return 0;
  }

  public RSItem[] getNestLocations() {
    RSItem[] arrayOfRSItem1 = this.inventory.getItems();
    int i = 0;
    for (int j = 0; j < arrayOfRSItem1.length; j++)
      for (k = 0; k < this.BNIDs.length; k++)
        if (arrayOfRSItem1[j].getID() == this.BNIDs[k])
          i++;
    RSItem[] arrayOfRSItem2 = new RSItem[i];
    int k = 0;
    for (int m = 0; m < arrayOfRSItem1.length; m++)
      for (int n = 0; n < this.BNIDs.length; n++)
        if (arrayOfRSItem1[m].getID() == this.BNIDs[n])
          arrayOfRSItem2[(k++)] = arrayOfRSItem1[m];
    return arrayOfRSItem2;
  }

  public void bank(boolean paramBoolean) {
    this.mouse.setSpeed(random(7, 8));
    Object localObject2;
    int j;
    if ((this.command.equals("Rimmington - Yews")) || (this.command.equals("Port Salim - Willows")))
    {
      this.mouse.setSpeed(random(7, 8));
      int i = 1;
      while (this.inventory.isFull()) {
        i = 1;
        while (i != 0) {
          this.status = "Opening bank.";
          localObject2 = this.objects.getAllAt(new RSTile(3047, 3237));
          Object localObject3 = null;
          for (int k = 0; k < localObject2.length; k++)
            if (localObject2[k].getID() == 36788)
              localObject3 = localObject2[k];
          RSModel localRSModel = localObject3.getModel();
          Point localPoint = localRSModel.getPoint();
          this.mouse.move(localPoint, 1, 1);
          if (this.menu.doAction("Deposit Bank deposit box"))
            i = 0;
        }
        sleep(random(3000, 4000));
        this.status = "Depositing.";
        localObject2 = getNestLocations();
        if (localObject2.length != 0) {
          for (j = 0; j < localObject2.length; j++)
            localObject2[j].doAction("Deposit Bird's nest");
        }
        this.bank.depositAllExcept(this.hatchetIDs);
      }
    }
    else
    {
      Object localObject1;
      if (paramBoolean) {
        localObject1 = this.npcs.getNearest(new int[] { this.bankerID });
        if (localObject1 != null) {
          do {
            while (!this.bank.isOpen()) {
              this.camera.setAngle(random(1, 359));
              this.status = "Opening bank.";
              if ((this.location.equals("Grand Exchange")) || (this.location.equals("Draynor")))
              {
                this.mouse.move(((RSNPC)localObject1).getModel().getPoint(), 1, 1);
                this.mouse.click(false);
                this.menu.doAction("Bank banker");
                sleep(random(600, 800));
              }
              if (!this.bank.isOpen())
                this.bank.open();
            }
            if (this.inventory.getCount(this.hatchetIDs) > 0) {
              this.status = "Depositing.";
              localObject2 = getNestLocations();
              if (localObject2.length != 0) {
                for (j = 0; j < localObject2.length; j++)
                  localObject2[j].doAction("Deposit Bird's nest");
              }
              this.bank.depositAllExcept(this.hatchetIDs);
            } else {
              this.status = "Depositing All.";
              this.bank.depositAll();
              sleep(random(600, 800));
              antiBan(random(100, 200));
            }
          }
          while (this.inventory.isFull());
          this.full = this.inventory.isFull();
          this.bank.close();
        } else {
          log("Can't find banker.");
        }
      } else {
        localObject1 = this.bankLocation;
        if (this.calc.tileOnScreen((RSTile)localObject1)) {
          do {
            while (!this.bank.isOpen()) {
              this.status = "Opening bank.";
              this.mouse.move(this.calc.tileToScreen((RSTile)localObject1));
              sleep(random(600, 800));
              this.mouse.click(false);
              this.menu.doAction("Bank");
              sleep(random(1000, 2000));
            }
            if (this.inventory.getCount(this.hatchetIDs) > 0) {
              this.status = "Depositing.";
              localObject2 = getNestLocations();
              if (localObject2.length != 0) {
                for (j = 0; j < localObject2.length; j++)
                  localObject2[j].doAction("Deposit Bird's nest");
              }
              this.bank.depositAllExcept(this.hatchetIDs);
            } else {
              this.status = "Depositing All.";
              this.bank.depositAll();
            }
            sleep(random(1000, 2000));
          }while (this.inventory.isFull());
          this.full = this.inventory.isFull();
        } else {
          log("Can't find banker.");
        }
      }
    }
  }

  public void walkToTrees() {
    System.currentTimeMillis();
    this.status = "Walking to trees.";
    int i = -1;
    int j = walkPath(this.bankToTrees);
    while (!atTrees()) {
      if ((!this.walking.isRunEnabled()) && (this.walking.getEnergy() > 20)) {
        this.walking.setRun(true);
        sleep(random(600, 800));
      }
      this.status = "Walking to trees.";
      if (this.command.equals("Mage Training Area - Magics")) {
        gate();
      }
      if ((this.command.equals("Tree Gnome - Yews")) && 
        (floorHeight() == 1)) {
        if (!playerIsNear(new RSTile(2445, 3433), 5)) {
          this.walking.walkTileMM(new RSTile(2445, 3433));
          while (getMyPlayer().isMoving())
            sleep(random(100, 200));
        }
        RSObject localRSObject = this.objects.getNearest(new int[] { 1744 });
        if (localRSObject != null)
          this.mouse.move(localRSObject.getModel().getPoint());
        this.mouse.click(true);
        sleep(random(600, 800));
      }

      if (!getMyPlayer().isMoving()) {
        sleep(random(600, 800));
        if (!getMyPlayer().isMoving())
          i = -1;
      }
      int k = 0;
      j = walkPath(this.bankToTrees);
      if (j > i) {
        if (this.walking.walkTileMM(this.bankToTrees[j], 1, 1))
          k = 1;
        sleep(random(400, 500));
        if (getMyPlayer().isMoving())
          k = 1;
      }
      if (k != 0) {
        i = j;
      }
      sleep(random(200, 300));
    }
  }

  public void doBank(int paramInt) {
    if (paramInt == 0) {
      walkToBank();
      sleep(random(600, 800));
    }
    if ((!this.command.equals("Castle Wars - Ivy")) && (!this.command.equals("Mage Training Area - Magics")))
    {
      bank(true);
    }
    else bank(false);
    sleep(random(600, 800));
    walkToTrees();
    sleep(random(600, 800));
  }

  public void messageReceived(MessageEvent paramMessageEvent)
  {
    String str = paramMessageEvent.getMessage();
    if (str.toLowerCase().contains("you get some yew logs"))
      this.yewsCut += 1;
    else if (str.toLowerCase().contains("you get some magic logs"))
      this.magicsCut += 1;
    else if (str.toLowerCase().contains("your inventory is too full to hold any more logs"))
    {
      this.full = true;
    } else if (str.toLowerCase().contains("you successfully chop away some ivy"))
    {
      this.ivyCut += 1;
    } else if (str.toLowerCase().contains("you get some willow logs"))
    {
      this.willowsCut += 1;
    } else if (str.toLowerCase().contains("you get some maple logs"))
      this.maplesCut += 1;
  }

  public boolean playerIsNear(RSTile paramRSTile, int paramInt) {
    return (Math.abs(getMyPlayer().getLocation().getX() - paramRSTile.getX()) < paramInt) && (Math.abs(getMyPlayer().getLocation().getY() - paramRSTile.getY()) < paramInt);
  }

  public boolean checkCurrentVersion()
  {
    try {
      URL localURL = new URL("http://www.conderogascripts.99k.org/CChopVersion.txt");

      BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(new BufferedInputStream(localURL.openConnection().getInputStream())));

      this.currentVersion = localBufferedReader.readLine().trim();
      localBufferedReader.close();
    }
    catch (Exception localException) {
    }
    if (this.currentVersion.equals("v1.23")) {
      return true;
    }
    log("Your version of the script is out of date.");

    return false;
  }

  public boolean update()
  {
    try {
      saveUrl("http://www.conderogascripts.99k.org/CChop.txt", "CChop.java");

      log("Update was successful. The new CChop.java file is wherever your RSBot file is.");
      log("Copy the file into your RSBot/Scripts/Sources folder, compile, and restart the script.");
      stopScript();
    } catch (Exception localException) {
      log("Update was unsuccessful.");
      return false;
    }

    return true;
  }

  public void saveUrl(String paramString1, String paramString2) throws MalformedURLException, IOException
  {
    BufferedInputStream localBufferedInputStream = null;
    FileOutputStream localFileOutputStream = null;
    try {
      localBufferedInputStream = new BufferedInputStream(new URL(paramString1).openStream());
      localFileOutputStream = new FileOutputStream(paramString2);

      byte[] arrayOfByte = new byte[1024];
      int i;
      while ((i = localBufferedInputStream.read(arrayOfByte, 0, 1024)) != -1)
        localFileOutputStream.write(arrayOfByte, 0, i);
    }
    finally {
      if (localBufferedInputStream != null)
        localBufferedInputStream.close();
      if (localFileOutputStream != null)
        localFileOutputStream.close();
    }
  }

  public void mouseExited(MouseEvent paramMouseEvent)
  {
  }

  public void mouseEntered(MouseEvent paramMouseEvent)
  {
  }

  public void mouseReleased(MouseEvent paramMouseEvent)
  {
    this.mouseColor = new Color(51, 153, 0, 255);
  }

  public void mousePressed(MouseEvent paramMouseEvent)
  {
    this.mouseColor = new Color(255, 0, 0, 100);
  }

  public void mouseClicked(MouseEvent paramMouseEvent)
  {
    this.p = paramMouseEvent.getPoint();
    if ((this.showPaint) && (this.p.getX() > 447.0D) && (this.p.getX() < 513.0D) && (this.p.getY() > 458.0D) && (this.p.getY() < 473.0D))
    {
      this.showPaint = false;
    } else if ((!this.showPaint) && (this.p.getX() > 447.0D) && (this.p.getX() < 513.0D) && (this.p.getY() > 458.0D) && (this.p.getY() < 473.0D))
    {
      this.showPaint = true;
    } else if ((this.showPaint) && (this.fancyPaint) && (this.p.getX() > 397.0D) && (this.p.getX() < 448.0D) && (this.p.getY() > 458.0D) && (this.p.getY() < 473.0D))
    {
      this.fancyPaint = false;
    } else if ((this.showPaint) && (!this.fancyPaint) && (this.p.getX() > 397.0D) && (this.p.getX() < 448.0D) && (this.p.getY() > 458.0D) && (this.p.getY() < 473.0D))
    {
      this.fancyPaint = true;
    }this.mouseColor = new Color(255, 0, 0, 100);
  }

  public int distanceTo(RSTile paramRSTile) {
    RSTile localRSTile = this.players.getMyPlayer().getLocation();
    return (int)Math.pow(Math.pow(paramRSTile.getY() - localRSTile.getY(), 2.0D) + Math.pow(paramRSTile.getX() - localRSTile.getX(), 2.0D), 0.5D);
  }

  public int distanceBetween(RSTile paramRSTile1, RSTile paramRSTile2)
  {
    return (int)Math.pow(Math.pow(paramRSTile1.getY() - paramRSTile2.getY(), 2.0D) + Math.pow(paramRSTile1.getX() - paramRSTile2.getX(), 2.0D), 0.5D);
  }

  public ArrayList<RSTile> fixPath(ArrayList<RSTile> paramArrayList)
  {
    int i = 0;
    do {
      i = 0;
      for (int j = 0; j < paramArrayList.size() - 1; j++)
        if (distanceBetween((RSTile)paramArrayList.get(j), (RSTile)paramArrayList.get(j + 1)) > 7) {
          paramArrayList.add(j + 1, getMidTile((RSTile)paramArrayList.get(j), (RSTile)paramArrayList.get(j + 1)));
          i = 1;
        }
    }
    while (i != 0);
    return paramArrayList;
  }

  public void getUnstuck() {
    log("Stuck! Moving to Closest Tree/Bank");
    RSTile[] arrayOfRSTile1 = { this.tree1, this.tree2, this.tree3, this.tree4, this.tree5, this.tree6, this.tree7 };
    int[] arrayOfInt = new int[8];
    for (int i = 0; i < 7; i++)
      arrayOfInt[i] = distanceTo(arrayOfRSTile1[i]);
    if (this.treesToBank.length > 0)
      arrayOfInt[7] = distanceTo(this.treesToBank[(this.treesToBank.length - 1)]);
    else
      arrayOfInt[7] = 9999;
    i = 9998;
    int j = -1;
    for (int k = 0; k < arrayOfInt.length; k++) {
      if (arrayOfInt[k] < i) {
        i = arrayOfInt[k];
        j = k;
      }
    }

    RSTile localRSTile = j == 7 ? this.treesToBank[(this.treesToBank.length - 1)] : arrayOfRSTile1[j];

    ArrayList localArrayList = new ArrayList();
    localArrayList.add(getMyPlayer().getLocation());
    localArrayList.add(localRSTile);
    localArrayList = fixPath(localArrayList);
    RSTile[] arrayOfRSTile2 = new RSTile[localArrayList.size()];
    for (int m = 0; m < localArrayList.size(); m++) {
      arrayOfRSTile2[m] = ((RSTile)localArrayList.get(m));
    }
    long l = System.currentTimeMillis();
    int n = -1;
    int i1 = walkPath(arrayOfRSTile2);
    int i2 = 0;

    while ((!playerIsNear(localRSTile, 5)) && (System.currentTimeMillis() - l < 20000L)) {
      boolean bool = false;
      i1 = walkPath(arrayOfRSTile2);
      if (i2 == 0) {
        if (i1 > n) {
          if (this.calc.tileOnScreen(arrayOfRSTile2[i1])) {
            if (!this.walking.walkTileOnScreen(arrayOfRSTile2[i1])) {
              if (this.walking.walkTileMM(arrayOfRSTile2[i1], 1, 1))
              {
                bool = true;
              }
              else bool = false; 
            }
            else
              bool = true;
          }
          else bool = this.walking.walkTileMM(arrayOfRSTile2[i1], 1, 1);

        }

        if (bool) {
          n = i1;
          if (i1 == arrayOfRSTile2.length - 1) {
            i2 = 1;
          }
        }
      }
      sleep(random(200, 300));
    }
  }

  public static int getGEValue(String paramString, int paramInt) {
    try {
      String[] arrayOfString = paramString.split(" ");
      String str1 = "";
      for (int i = 0; i < arrayOfString.length; i++)
        if (i == arrayOfString.length - 1)
          str1 = str1 + arrayOfString[i];
        else
          str1 = str1 + "_" + arrayOfString[i];
      URL localURL = new URL("http://services.runescape.com/m=itemdb_rs/" + str1 + "/viewitem.ws?obj=" + paramInt);

      InputStream localInputStream = localURL.openStream();
      InputStreamReader localInputStreamReader = new InputStreamReader(localInputStream);
      BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);

      Object localObject = "";
      String str2;
      while ((str2 = localBufferedReader.readLine()) != null) {
        if (str2.contains("Current guide price:"))
          localObject = str2;
      }
      System.out.println((String)localObject);
      if (((String)localObject).length() < 29) {
        return -1;
      }
      localObject = ((String)localObject).substring(28);
      localObject = ((String)localObject).replaceAll(",", "");
      return Integer.parseInt((String)localObject);
    }
    catch (Exception localException) {
    }
    return -1;
  }

  public int loop()
  {
    try
    {
      if (this.safety < 1)
      {
        int i;
        if (!this.game.isFixed())
          for (i = 0; i < 3; i++)
            log("For best results, please set your window mode to 'fixed'.");
        setUp();
        log("Chopping Command: " + this.command);
        if ((this.treeType.equals("yews")) || (this.treeType.equals("magics")) || (this.treeType.equals("willows")) || (this.treeType.equals("maples")) || (this.treeType.equals("oaks")))
        {
          this.status = "Looking up GE data.";
          log("Looking up log prices...");
          if (this.treeType.equals("yews")) {
            for (i = 0; i < 3; i++) {
              this.yewPrice = getGEValue("Yew logs", 1515);
              if (this.yewPrice != -1)
                break;
            }
            log("Yew log price: " + this.yewPrice);
          } else if (this.treeType.equals("magics")) {
            for (i = 0; i < 3; i++) {
              this.magicPrice = getGEValue("Magic logs", 1513);
              if (this.magicPrice != -1)
                break;
            }
            log("Magic logs price: " + this.magicPrice);
          } else if (this.treeType.equals("willows")) {
            for (i = 0; i < 3; i++) {
              this.willowPrice = getGEValue("Willow logs", 1519);
              if (this.willowPrice != -1)
                break;
            }
            log("Willow logs price: " + this.willowPrice);
          } else if (this.treeType.equals("maples")) {
            for (i = 0; i < 3; i++) {
              this.maplePrice = getGEValue("Maple logs", 1517);
              if (this.maplePrice != -1)
                break;
            }
            log("Maple logs price: " + this.maplePrice);
          } else if (this.treeType.equals("oaks")) {
            for (i = 0; i < 3; i++) {
              this.oakPrice = getGEValue("Oak logs", 1521);
              if (this.oakPrice != -1)
                break;
            }
            log("Oak logs price: " + this.oakPrice);
          }
          this.camera.setPitch(true);
        } else {
          this.camera.setPitch(false);
        }this.safety = 1;
        this.full = this.inventory.isFull();
        if ((!this.full) && (atBank()))
          while (!atTrees())
            walkToTrees();
        if ((this.full) && (atBank()))
          doBank(1);
        if ((this.full) && (atTrees())) {
          doBank(0);
        }
      }
      RSTile[] arrayOfRSTile = { this.tree1, this.tree2, this.tree3, this.tree4, this.tree5, this.tree6, this.tree7 };
      this.mouse.setSpeed(random(5, 8));
      antiBan(random(1, 120));
      updateStatus();
      this.full = this.inventory.isFull();

      if (!this.full)
        pickUpNest();
      if ((this.full) && (!atBank()))
        walkToBank();
      else if ((!this.full) && (atBank()))
        walkToTrees();
      else if (this.full)
      {
        if (!this.location.equals("Taverly"))
          doBank(0);
      }
      if (this.status.equals("Chopping!")) {
        if (this.safety < 3) {
          hoverMouse();
          this.safety += 1;
        }
      } else if ((this.status.equals("Not chopping.")) || (this.status.contains("Moving to tree")))
      {
        long l = System.currentTimeMillis();

        while ((!getNextTree().isOnScreen()) && (System.currentTimeMillis() - l < 5000L))
          moveToNextTree();
        if (!getNextTree().isOnScreen())
        {
          if ((!getMyPlayer().isMoving()) && (this.failSafeTimer == 0L))
            this.failSafeTimer = System.currentTimeMillis();
          if ((!getMyPlayer().isMoving()) && (System.currentTimeMillis() - this.failSafeTimer > 10000L))
          {
            getUnstuck();
            this.failSafeTimer = 0L;
          }
        }
        chop(false);
      } else if (this.status.equals("Waiting.")) {
        if (this.safety == 3) {
          System.currentTimeMillis();
          while (!playerIsNear(arrayOfRSTile[(this.nextTree - 1)], 4))
            moveToNextTree();
          if (!this.chopType.equals("ivy"))
            this.camera.turnTo(arrayOfRSTile[(this.nextTree - 1)]);
          this.camera.setPitch(random(20, 50));
        }
        if (this.safety < 5)
          hoverMouse();
        this.safety += 1;
      }

    }
    catch (Exception localException)
    {
    }

    return random(300, 500);
  }

  public void antiBan(int paramInt)
  {
    this.status += "(AB)";
    this.mouse.setSpeed(random(7, 8));
    if ((paramInt == 1) && 
      (random(1, 8) == 2))
      this.mouse.moveRandomly(900, 1200);
    if ((paramInt == 2) && 
      (random(1, 8) == 2))
      this.mouse.moveRandomly(400, 800);
    if ((paramInt == 3) && 
      (random(1, 8) == 2)) {
      this.mouse.moveRandomly(200, 700);
    }
    if ((paramInt == 4) && 
      (random(1, 12) == 2)) {
      this.game.openTab(2);
      sleep(random(600, 800));
      this.mouse.move(random(681, 690), random(365, 370), 0, 0);
      sleep(random(1900, 2000));
      this.game.openTab(4);
    }
    if ((paramInt == 5) && 
      (random(1, 12) == 2) && (this.game.isFixed())) {
      this.mouse.move(random(527, 540), random(58, 65), 0, 0);
      sleep(random(800, 1000));
      this.mouse.click(true);
      this.mouse.moveRandomly(20, 50);
      sleep(random(1000, 1500));
    }
    if ((this.takeBreaks) && 
      (paramInt == 6) && 
      (random(1, 6) == 2)) {
      if (random(1, 2) == 1)
        this.mouse.moveRandomly(50, 75);
      this.breakActive = true;
      this.breakLength = random(5, 13);
      this.breakStart = System.currentTimeMillis();
      sleep(this.breakLength * 1000);
      this.breakActive = false;
    }
    if ((paramInt == 7) && 
      (random(1, 3) == 2)) {
      int i = random(1, 2);
      this.camera.setAngle(random(1, 359));
      if (i != 1) {
        this.camera.setPitch(random(1, 99));
      }
    }
    if ((paramInt == 8) && 
      (random(1, 4) == 2)) {
      int[] arrayOfInt = { 0, 2, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15 };
      this.game.openTab(arrayOfInt[random(0, arrayOfInt.length - 1)]);
      this.mouse.moveRandomly(175, 200);
      sleep(random(1600, 1800));
      sleep(random(900, 1000));
    }

    if ((paramInt == 9) && 
      (random(1, 10) == 2))
      this.mouse.moveOffScreen();
    this.status = this.status.substring(0, this.status.indexOf(40));
  }

  public void onRepaint(Graphics paramGraphics)
  {
    if (this.game.isLoggedIn())
      try {
        if (this.breakActive) {
          paramGraphics.setColor(new Color(0, 0, 0, 100));
          paramGraphics.fillRect(0, 0, 764, 501);
          paramGraphics.setColor(new Color(255, 0, 0));
          l1 = this.breakLength * 1000 - (System.currentTimeMillis() - this.breakStart);

          l2 = l1 / 1000L;
          l1 -= l2 * 1000L;
          String str = "";
          if (l1 < 10L)
            str = "00" + l1;
          else if (l1 < 100L)
            str = "0" + l1;
          else {
            str = "" + l1;
          }
          l1 -= l2 * 1000L;
          paramGraphics.drawString("Script will resume in: " + l2 + ":" + str, 50, 200);
        }

        if ((!this.treeType.equals("ivy")) && (!this.treeType.equals(".")) && (!this.treeType.equals("willows")))
        {
          checkTrees();
        }
        else checkIvy();
        calculateNextTree();
        if (this.startExp == 0) {
          this.startExp = this.skills.getCurrentExp(Skills.getIndex("woodcutting"));

          this.startLevel = this.skills.getCurrentLevel(Skills.getIndex("woodcutting"));
        }

        this.lvlsGained = (this.skills.getCurrentLevel(Skills.getIndex("woodcutting")) - this.startLevel);

        this.expGained = (this.skills.getCurrentExp(Skills.getIndex("woodcutting")) - this.startExp);

        long l1 = this.skills.getExpToNextLevel(Skills.getIndex("woodcutting"));

        long l2 = System.currentTimeMillis() - this.startTime;
        double d1 = System.currentTimeMillis() - this.startTimeDbl;
        long l3 = l2 / 3600000L;
        l2 -= l3 * 3600000L;
        long l4 = l2 / 60000L;
        l2 -= l4 * 60000L;
        long l5 = l2 / 1000L;
        long l6 = 0L;
        long l7 = 0L;
        long l8 = 0L;
        long l9 = 0L;
        if ((d1 != 0.0D) && (this.expGained != 0)) {
          l6 = ()(l1 / (this.expGained / (d1 / 3600000.0D)) * 3600000.0D);
          l7 = l6 / 3600000L;
          l6 -= l7 * 3600000L;
          l8 = l6 / 60000L;
          l6 -= l8 * 60000L;
          l9 = l6 / 1000L;
        }
        this.yewsCut = (this.expGained / 175);
        this.magicsCut = (this.expGained / 250);
        this.ivyCut = (int)((this.expGained + 1) / 332.5D);
        this.willowsCut = (int)((this.expGained + 1) / 67.5D);
        this.maplesCut = (this.expGained / 100);
        this.oaksCut = (int)((this.expGained + 1) / 37.5D);

        if (this.fancyPaint) {
          if (this.showPaint) {
            onRepaint2(paramGraphics, true);

            paramGraphics.setColor(new Color(0, 0, 0, 255));
            paramGraphics.setFont(new Font("Comic Sans MS", 0, 12));
            paramGraphics.drawString("  v1.23", 450, 360);
            paramGraphics.setFont(new Font("Comic Sans MS", 0, 11));
            paramGraphics.drawString("Levels Gained: " + this.lvlsGained, 16, 40);
            if (this.treeType.equals("yews"))
              paramGraphics.drawString("Yews Chopped: " + this.yewsCut, 395, 22);
            else if (this.treeType.equals("magics")) {
              paramGraphics.drawString("Magics Chopped: " + this.magicsCut, 395, 22);
            }
            else if (this.treeType.equals("ivy"))
              paramGraphics.drawString("Ivy Chopped: " + this.ivyCut, 395, 22);
            else if (this.treeType.equals("willows")) {
              paramGraphics.drawString("Willows Chopped: " + this.willowsCut, 395, 22);
            }
            else if (this.treeType.equals("maples")) {
              paramGraphics.drawString("Maples Chopped: " + this.maplesCut, 395, 22);
            }
            else if (this.treeType.equals("oaks"))
              paramGraphics.drawString("Oaks Chopped: " + this.oaksCut, 395, 22);
            paramGraphics.drawString("Exp Gained: " + this.expGained, 16, 55);
            paramGraphics.drawString("Time Running: " + l3 + ":" + l4 + ":" + l5, 16, 97);

            double d2 = Skills.XP_TABLE[(this.skills.getCurrentLevel(Skills.getIndex("woodcutting")) + 1)] - Skills.XP_TABLE[this.skills.getCurrentLevel(Skills.getIndex("woodcutting"))];

            double d3 = (d2 - l1) / d2 * 512.0D;

            paramGraphics.setColor(new Color(255, 0, 0, 255));
            paramGraphics.fillRoundRect(4, 320, 512, 18, 8, 8);

            paramGraphics.setColor(new Color(51, 153, 0, 255));
            paramGraphics.fillRoundRect(4, 320, (int)d3, 18, 4, 4);
            paramGraphics.setColor(new Color(0, 0, 0, 255));
            paramGraphics.drawString(this.skills.getPercentToNextLevel(Skills.getIndex("woodcutting")) + "% to: " + (this.skills.getCurrentLevel(Skills.getIndex("woodcutting")) + 1) + " (" + l1 + " exp)", 215, 334);

            paramGraphics.setColor(new Color(255, 255, 255, 100));
            paramGraphics.fillRoundRect(4, 320, 512, 9, 4, 4);

            if (d1 != 0.0D)
              paramGraphics.setColor(new Color(0, 0, 0, 255));
            paramGraphics.drawString("Exp/Hr: " + (int)(this.expGained / (d1 / 3600000.0D)), 16, 69);

            paramGraphics.drawString("Status: " + this.status, 16, 22);

            if (this.treeType.equals("yews")) {
              paramGraphics.drawString("Money Gained: " + this.yewPrice * this.yewsCut, 154, 22);

              if (d1 != 0.0D) {
                paramGraphics.drawString("Money/Hr: " + (int)(this.yewPrice * this.yewsCut / (d1 / 3600000.0D)), 289, 22);
              }

            }
            else if (this.treeType.equals("magics")) {
              paramGraphics.drawString("Money Gained: " + this.magicPrice * this.magicsCut, 154, 22);

              if (d1 != 0.0D) {
                paramGraphics.drawString("Money/Hr: " + (int)(this.magicPrice * this.magicsCut / (d1 / 3600000.0D)), 289, 22);
              }

            }
            else if (this.treeType.equals("ivy")) {
              paramGraphics.drawString("Nests Collected: " + this.nests, 154, 22);
              if (d1 != 0.0D) {
                paramGraphics.drawString("Nests/Hr: " + (int)(this.nests / (d1 / 3600000.0D)), 289, 22);
              }
            }
            else if (this.treeType.equals("willows")) {
              paramGraphics.drawString("Money Gained: " + this.willowPrice * this.willowsCut, 154, 22);

              if (d1 != 0.0D) {
                paramGraphics.drawString("Money/Hr: " + (int)(this.willowPrice * this.willowsCut / (d1 / 3600000.0D)), 289, 22);
              }

            }
            else if (this.treeType.equals("maples")) {
              paramGraphics.drawString("Money Gained: " + this.maplePrice * this.maplesCut, 154, 22);

              if (d1 != 0.0D) {
                paramGraphics.drawString("Money/Hr: " + (int)(this.maplePrice * this.maplesCut / (d1 / 3600000.0D)), 289, 22);
              }

            }
            else if (this.treeType.equals("oaks")) {
              paramGraphics.drawString("Money Gained: " + this.oakPrice * this.oaksCut, 154, 22);

              if (d1 != 0.0D) {
                paramGraphics.drawString("Money/Hr: " + (int)(this.oakPrice * this.oaksCut / (d1 / 3600000.0D)), 289, 22);
              }

            }

            paramGraphics.drawString("Est. Time to Lvl: " + l7 + ":" + l8 + ":" + l9, 16, 83);

            Point localPoint2 = this.mouse.getLocation();
            int k = (int)localPoint2.getX();
            int m = (int)localPoint2.getY();
            paramGraphics.setColor(this.mouseColor);
            paramGraphics.drawLine(k, 0, k, 501);
            paramGraphics.drawLine(0, m, 764, m);
            paramGraphics.fillRect(k - 1, m - 1, 3, 3);

            Color localColor = new Color(255, 0, 0, 100);
            if (this.mouseColor.equals(localColor)) {
              this.mouseColor = new Color(51, 153, 0, 255);
            }
            paramGraphics.setColor(Color.GREEN);
            this.stump1 = this.calc.tileToScreen(this.tree1);
            this.stump2 = this.calc.tileToScreen(this.tree2);
            this.stump3 = this.calc.tileToScreen(this.tree3);
            this.stump4 = this.calc.tileToScreen(this.tree4);
            this.stump5 = this.calc.tileToScreen(this.tree5);
            this.stump6 = this.calc.tileToScreen(this.tree6);
            this.stump7 = this.calc.tileToScreen(this.tree7);

            if ((this.tree1Status) && (this.tree1AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree1TimeAlive / 1000L) + "s", (int)this.stump1.getX(), (int)this.stump1.getY());
            }
            if ((this.tree2Status) && (this.tree2AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree2TimeAlive / 1000L) + "s", (int)this.stump2.getX(), (int)this.stump2.getY());
            }
            if ((this.tree3Status) && (this.tree3AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree3TimeAlive / 1000L) + "s", (int)this.stump3.getX(), (int)this.stump3.getY());
            }
            if ((this.tree4Status) && (this.tree4AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree4TimeAlive / 1000L) + "s", (int)this.stump4.getX(), (int)this.stump4.getY());
            }
            if ((this.tree5Status) && (this.tree5AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree5TimeAlive / 1000L) + "s", (int)this.stump5.getX(), (int)this.stump5.getY());
            }
            if ((this.tree6Status) && (this.tree6AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree6TimeAlive / 1000L) + "s", (int)this.stump6.getX(), (int)this.stump6.getY());
            }
            if ((this.tree7Status) && (this.tree7AliveTime != 0L)) {
              paramGraphics.drawString((int)(this.tree7TimeAlive / 1000L) + "s", (int)this.stump7.getX(), (int)this.stump7.getY());
            }

            paramGraphics.setColor(Color.MAGENTA);
            if ((!this.tree1Status) && (this.tree1DeadTime != 0L)) {
              paramGraphics.drawString((int)(this.tree1TimeDead / 1000L) + "s", (int)this.stump1.getX(), (int)this.stump1.getY());
            }
            if ((!this.tree2Status) && (this.tree2DeadTime != 0L)) {
              paramGraphics.drawString((int)(this.tree2TimeDead / 1000L) + "s", (int)this.stump2.getX(), (int)this.stump2.getY());
            }
            if ((!this.tree3Status) && (this.tree3DeadTime != 0L)) {
              paramGraphics.drawString((int)(this.tree3TimeDead / 1000L) + "s", (int)this.stump3.getX(), (int)this.stump3.getY());
            }
            if ((!this.tree4Status) && (this.tree4DeadTime != 0L)) {
              paramGraphics.drawString((int)(this.tree4TimeDead / 1000L) + "s", (int)this.stump4.getX(), (int)this.stump4.getY());
            }
            if ((!this.tree5Status) && (this.tree5DeadTime != 0L)) {
              paramGraphics.drawString((int)(this.tree5TimeDead / 1000L) + "s", (int)this.stump5.getX(), (int)this.stump5.getY());
            }
            if ((!this.tree6Status) && (this.tree6DeadTime != 0L)) {
              paramGraphics.drawString((int)(this.tree6TimeDead / 1000L) + "s", (int)this.stump6.getX(), (int)this.stump6.getY());
            }
            if ((!this.tree7Status) && (this.tree7DeadTime != 0L))
              paramGraphics.drawString((int)(this.tree7TimeDead / 1000L) + "s", (int)this.stump7.getX(), (int)this.stump7.getY());
          }
          else {
            paramGraphics.setColor(new Color(51, 153, 0, 255));
            paramGraphics.fillRect(448, 459, 64, 13);
            paramGraphics.setColor(new Color(0, 0, 0, 255));
            paramGraphics.drawRect(448, 459, 64, 13);
            paramGraphics.drawString("Hide/Show", 450, 470);
          }

        }
        else if (this.showPaint) {
          onRepaint2(paramGraphics, false);
          paramGraphics.setColor(new Color(0, 0, 0, 205));
          paramGraphics.fillRoundRect(333, 160, 181, 179, 6, 6);
          paramGraphics.setColor(new Color(255, 0, 0, 255));
          paramGraphics.setFont(new Font("Comic Sans MS", 0, 12));
          paramGraphics.drawString("Conderoga's Chopper v1.23", 338, 177);
          paramGraphics.setFont(new Font("Comic Sans MS", 0, 11));
          paramGraphics.drawString("Levels Gained: " + this.lvlsGained, 344, 192);
          if (this.treeType.equals("yews"))
            paramGraphics.drawString("Yews Chopped: " + this.yewsCut, 344, 207);
          else if (this.treeType.equals("magics")) {
            paramGraphics.drawString("Magics Chopped: " + this.magicsCut, 344, 207);
          }
          else if (this.treeType.equals("ivy"))
            paramGraphics.drawString("Ivy Chopped: " + this.ivyCut, 344, 207);
          else if (this.treeType.equals("willows")) {
            paramGraphics.drawString("Willows Chopped: " + this.willowsCut, 344, 207);
          }
          else if (this.treeType.equals("maples")) {
            paramGraphics.drawString("Maples Chopped: " + this.maplesCut, 344, 207);
          }
          else if (this.treeType.equals("oaks"))
            paramGraphics.drawString("Oaks Chopped: " + this.oaksCut, 344, 207);
          paramGraphics.drawString("Exp Gained: " + this.expGained, 344, 222);
          paramGraphics.drawString("Time Running: " + l3 + ":" + l4 + ":" + l5, 344, 237);

          paramGraphics.setColor(new Color(255, 0, 0, 255));
          paramGraphics.fillRoundRect(344, 241, 150, 20, 8, 8);

          paramGraphics.setColor(new Color(0, 255, 0, 255));
          paramGraphics.fillRoundRect(344, 241, (int)(this.skills.getPercentToNextLevel(Skills.getIndex("woodcutting")) * 1.5D), 20, 8, 8);

          paramGraphics.setColor(new Color(255, 255, 255, 100));
          paramGraphics.drawString(this.skills.getPercentToNextLevel(Skills.getIndex("woodcutting")) + "% to: " + (this.skills.getCurrentLevel(Skills.getIndex("woodcutting")) + 1) + " (" + l1 + " exp)", 348, 256);

          paramGraphics.fillRoundRect(345, 251, 148, 10, 8, 8);
          paramGraphics.setColor(new Color(0, 0, 0, 255));
          paramGraphics.drawString(this.skills.getPercentToNextLevel(Skills.getIndex("woodcutting")) + "% to: " + (this.skills.getCurrentLevel(Skills.getIndex("woodcutting")) + 1) + " (" + l1 + " exp)", 347, 255);

          paramGraphics.setColor(new Color(255, 0, 0, 255));
          if (d1 != 0.0D) {
            paramGraphics.drawString("Exp/Hr: " + (int)(this.expGained / (d1 / 3600000.0D)), 344, 274);
          }

          paramGraphics.drawString("Status: " + this.status, 344, 289);

          if (this.treeType.equals("yews")) {
            paramGraphics.drawString("Money Gained: " + this.yewPrice * this.yewsCut, 344, 304);

            if (d1 != 0.0D) {
              paramGraphics.drawString("Money/Hr: " + (int)(this.yewPrice * this.yewsCut / (d1 / 3600000.0D)), 344, 319);
            }

          }
          else if (this.treeType.equals("magics")) {
            paramGraphics.drawString("Money Gained: " + this.magicPrice * this.magicsCut, 344, 304);

            if (d1 != 0.0D) {
              paramGraphics.drawString("Money/Hr: " + (int)(this.magicPrice * this.magicsCut / (d1 / 3600000.0D)), 344, 319);
            }

          }
          else if (this.treeType.equals("ivy")) {
            paramGraphics.drawString("Nests Collected: " + this.nests, 344, 304);
            if (d1 != 0.0D) {
              paramGraphics.drawString("Nests/Hr: " + (int)(this.nests / (d1 / 3600000.0D)), 344, 319);
            }
          }
          else if (this.treeType.equals("willows")) {
            paramGraphics.drawString("Money Gained: " + this.willowPrice * this.willowsCut, 344, 304);

            if (d1 != 0.0D) {
              paramGraphics.drawString("Money/Hr: " + (int)(this.willowPrice * this.willowsCut / (d1 / 3600000.0D)), 344, 319);
            }

          }
          else if (this.treeType.equals("maples")) {
            paramGraphics.drawString("Money Gained: " + this.maplePrice * this.maplesCut, 344, 304);

            if (d1 != 0.0D) {
              paramGraphics.drawString("Money/Hr: " + (int)(this.maplePrice * this.maplesCut / (d1 / 3600000.0D)), 344, 319);
            }

          }
          else if (this.treeType.equals("oaks")) {
            paramGraphics.drawString("Money Gained: " + this.oakPrice * this.oaksCut, 344, 304);

            if (d1 != 0.0D) {
              paramGraphics.drawString("Money/Hr: " + (int)(this.oakPrice * this.oaksCut / (d1 / 3600000.0D)), 344, 319);
            }

          }

          paramGraphics.drawString("Est. Time to Lvl: " + l7 + ":" + l8 + ":" + l9, 344, 334);

          Point localPoint1 = this.mouse.getLocation();
          int i = (int)localPoint1.getX();
          int j = (int)localPoint1.getY();
          paramGraphics.setColor(new Color(0, 255, 0, 100));
          paramGraphics.drawLine(i, 0, i, 501);
          paramGraphics.drawLine(0, j, 764, j);

          paramGraphics.setColor(Color.GREEN);
          this.stump1 = this.calc.tileToScreen(this.tree1);
          this.stump2 = this.calc.tileToScreen(this.tree2);
          this.stump3 = this.calc.tileToScreen(this.tree3);
          this.stump4 = this.calc.tileToScreen(this.tree4);
          this.stump5 = this.calc.tileToScreen(this.tree5);
          this.stump6 = this.calc.tileToScreen(this.tree6);
          this.stump7 = this.calc.tileToScreen(this.tree7);

          if ((this.tree1Status) && (this.tree1AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree1TimeAlive / 1000L) + "s", (int)this.stump1.getX(), (int)this.stump1.getY());
          }
          if ((this.tree2Status) && (this.tree2AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree2TimeAlive / 1000L) + "s", (int)this.stump2.getX(), (int)this.stump2.getY());
          }
          if ((this.tree3Status) && (this.tree3AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree3TimeAlive / 1000L) + "s", (int)this.stump3.getX(), (int)this.stump3.getY());
          }
          if ((this.tree4Status) && (this.tree4AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree4TimeAlive / 1000L) + "s", (int)this.stump4.getX(), (int)this.stump4.getY());
          }
          if ((this.tree5Status) && (this.tree5AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree5TimeAlive / 1000L) + "s", (int)this.stump5.getX(), (int)this.stump5.getY());
          }
          if ((this.tree6Status) && (this.tree6AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree6TimeAlive / 1000L) + "s", (int)this.stump6.getX(), (int)this.stump6.getY());
          }
          if ((this.tree7Status) && (this.tree7AliveTime != 0L)) {
            paramGraphics.drawString((int)(this.tree7TimeAlive / 1000L) + "s", (int)this.stump7.getX(), (int)this.stump7.getY());
          }

          paramGraphics.setColor(Color.MAGENTA);
          if ((!this.tree1Status) && (this.tree1DeadTime != 0L)) {
            paramGraphics.drawString((int)(this.tree1TimeDead / 1000L) + "s", (int)this.stump1.getX(), (int)this.stump1.getY());
          }
          if ((!this.tree2Status) && (this.tree2DeadTime != 0L)) {
            paramGraphics.drawString((int)(this.tree2TimeDead / 1000L) + "s", (int)this.stump2.getX(), (int)this.stump2.getY());
          }
          if ((!this.tree3Status) && (this.tree3DeadTime != 0L)) {
            paramGraphics.drawString((int)(this.tree3TimeDead / 1000L) + "s", (int)this.stump3.getX(), (int)this.stump3.getY());
          }
          if ((!this.tree4Status) && (this.tree4DeadTime != 0L)) {
            paramGraphics.drawString((int)(this.tree4TimeDead / 1000L) + "s", (int)this.stump4.getX(), (int)this.stump4.getY());
          }
          if ((!this.tree5Status) && (this.tree5DeadTime != 0L)) {
            paramGraphics.drawString((int)(this.tree5TimeDead / 1000L) + "s", (int)this.stump5.getX(), (int)this.stump5.getY());
          }
          if ((!this.tree6Status) && (this.tree6DeadTime != 0L)) {
            paramGraphics.drawString((int)(this.tree6TimeDead / 1000L) + "s", (int)this.stump6.getX(), (int)this.stump6.getY());
          }
          if ((!this.tree7Status) && (this.tree7DeadTime != 0L))
            paramGraphics.drawString((int)(this.tree7TimeDead / 1000L) + "s", (int)this.stump7.getX(), (int)this.stump7.getY());
        }
        else
        {
          paramGraphics.setColor(new Color(51, 153, 0, 255));
          paramGraphics.fillRect(448, 459, 64, 13);
          paramGraphics.setColor(new Color(0, 0, 0, 255));
          paramGraphics.drawRect(448, 459, 64, 13);
          paramGraphics.drawString("Hide/Show", 450, 470);
        }
      }
      catch (Exception localException)
      {
      }
  }

  private Image getImage(String paramString)
  {
    try {
      return ImageIO.read(new URL(paramString)); } catch (IOException localIOException) {
    }
    return null;
  }

  public void onRepaint2(Graphics paramGraphics, boolean paramBoolean)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    if (paramBoolean) {
      localGraphics2D.drawImage(this.img1, 342, 350, null);
      localGraphics2D.drawImage(this.img2, 5, 6, null);
      localGraphics2D.drawImage(this.img4, 5, 29, null);
    }
    localGraphics2D.setColor(new Color(51, 153, 0, 255));
    localGraphics2D.fillRect(448, 459, 64, 13);
    localGraphics2D.fillRect(398, 459, 50, 13);
    localGraphics2D.setColor(new Color(0, 0, 0, 255));
    localGraphics2D.drawRect(448, 459, 64, 13);
    localGraphics2D.drawRect(398, 459, 50, 13);
    localGraphics2D.drawString("Hide/Show", 450, 470);
    if (paramBoolean)
      localGraphics2D.drawString("Simple", 405, 470);
    else
      localGraphics2D.drawString("Adv.", 415, 470);
  }

  public void onFinish()
  {
    log("Exp gained: " + this.expGained);
    log("Levels gained: " + this.lvlsGained);
    log("Thanks for using Conderoga's Chopper!");
  }

  public void openURL(String paramString)
  {
    String str = System.getProperty("os.name");
    try
    {
      Object localObject;
      Method localMethod;
      if (str.startsWith("Mac OS")) {
        localObject = Class.forName("com.apple.eio.FileManager");

        localMethod = ((Class)localObject).getDeclaredMethod("openURL", new Class[] { String.class });

        localMethod.invoke(null, new Object[] { paramString });
      } else if (str.startsWith("Windows")) {
        Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + paramString);
      }
      else {
        localObject = new String[] { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };

        localMethod = null;
        for (int i = 0; (i < localObject.length) && (localMethod == null); i++) {
          if (Runtime.getRuntime().exec(new String[] { "which", localObject[i] }).waitFor() != 0) {
            continue;
          }
          localMethod = localObject[i];
        }

        if (localMethod == null) {
          throw new Exception("Could not find web browser");
        }
        Runtime.getRuntime().exec(new String[] { localMethod, paramString });
      }
    }
    catch (Exception localException)
    {
    }
  }
}